:root {
    --bg-color: #FAFAFA;
    --text-primary: #111;
    --text-secondary: #555;
    --card-bg: #FFFFFF;
    --grid-gap: 24px;
    --card-radius: 32px;
    --sidebar-width: 400px;

    /* Semantic text colors */
    --bio-text: #333;
    --bio-light-text: #666;

    /* Borders & Shadows */
    --border-color: rgba(0, 0, 0, 0.04);
    --shadow-color: rgba(0, 0, 0, 0.02);
    --hover-shadow: rgba(0, 0, 0, 0.08);

    /* Button Colors */
    --btn-bg: #eff3f4;
    --btn-text: #0f1419;
    --btn-hover: #e2e6ea;
}

[data-theme="dark"] {
    --bg-color: #1F1F1F;
    --text-primary: #f0f0f0;
    --text-secondary: #aaaaaa;
    --card-bg: #292929;

    /* Semantic text colors */
    --bio-text: #e0e0e0;
    --bio-light-text: #a0a0a0;

    /* Borders & Shadows */
    --border-color: rgba(255, 255, 255, 0.08);
    --shadow-color: rgba(0, 0, 0, 0.2);
    --hover-shadow: rgba(0, 0, 0, 0.4);

    /* Button Colors */
    --btn-bg: #3a3a3a;
    --btn-text: #ffffff;
    --btn-hover: #4a4a4a;
}

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

body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-primary);
    min-height: 100vh;
    display: flex;
    justify-content: center;
    padding: 40px;
}

.main-wrapper {
    width: 100%;
    max-width: 1600px;
    /* Limits max width on huge screens */
    display: flex;
    flex-direction: column;
    gap: 40px;
}

/* --- Sidebar --- */
.profile-sidebar {
    width: 100%;
    padding: 10px;
}

.avatar-container img {
    width: 160px;
    height: 160px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 24px;
}

.profile-content h1 {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 4px;
    letter-spacing: -0.5px;
}

.handle {
    color: var(--text-secondary);
    font-size: 18px;
    font-weight: 500;
    margin-bottom: 24px;
}

.bio p {
    font-size: 18px;
    line-height: 1.5;
    color: var(--bio-text);
    margin-bottom: 12px;
}

.bio-light {
    color: var(--bio-light-text);
    margin-top: 20px;
}

.theme-toggle {
    position: fixed;
    top: 20px;
    left: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px var(--shadow-color);
    border-radius: 50px;
    padding: 12px 18px;
    cursor: pointer;
    color: var(--text-primary);
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: transform 0.2s ease, background 0.2s;
}

.theme-toggle:hover {
    transform: scale(1.05);
}

/* --- Bento Grid (Mobile Default / < 820px) --- */
.bento-grid {
    display: grid;
    /* Force 2 columns on small/medium screens */
    grid-template-columns: repeat(2, 1fr);
    gap: var(--grid-gap);
    /* Strict max-width for the 2-column view */
    max-width: 420px;
    margin: 0 auto;
    /* Center the grid */
    grid-auto-flow: dense;
    width: 100%;
}

/* Card Base Styles */
.card {
    background: var(--card-bg);
    border-radius: var(--card-radius);
    position: relative;
    overflow: hidden;
    text-decoration: none;
    color: inherit;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 6px var(--shadow-color);
    display: flex;
    flex-direction: column;
    /* Fill the grid area */
    height: 100%;
    width: 100%;
}

/* Allow standard cards to dictate their own height via aspect-ratio */
.standard {
    height: auto;
    min-height: 100%;
}

.card:hover {
    transform: translateY(-4px);
    box-shadow: 0 12px 24px var(--hover-shadow);
}

/* --- Card Sizing Classes (Universal Spans & Ratios) --- */

/* 1x1 Standard: Defines the unit square */
.standard {
    grid-column: span 1;
    grid-row: span 1;
    aspect-ratio: 1 / 1;
}

/* 2x1 Wide */
.wide {
    grid-column: span 2;
    grid-row: span 1;
    aspect-ratio: 2 / 1;
}

/* 1x2 Tall */
.tall {
    grid-column: span 1;
    grid-row: span 2;
    /* No aspect ratio needed, it stretches to fill 2 rows */
}

/* 2x2 Big */
.big {
    grid-column: span 2;
    grid-row: span 2;
    aspect-ratio: 1 / 1;
    /* 2x2 units is a square */
}


/* --- Card Types & Content --- */

/* Media Cards (Images/Videos) */
.media-card {
    padding: 0;
}

.media-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.media-card video {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

/* Floating Labels inside media cards */
.floating-label {
    position: absolute;
    bottom: 20px;
    left: 20px;
    background: var(--card-bg);
    color: var(--text-primary);
    padding: 8px 16px;
    border-radius: 100px;
    font-weight: 600;
    font-size: 14px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.floating-label.white {
    /* If needed specific styling */
}

.floating-label.dark {
    background: #000;
    color: #fff;
    border: 1px solid #333;
}

/* Social Cards */
.social-card {
    padding: 24px;
    /* Ensure content fits or scrolls if too small? */
    justify-content: space-between;
    align-items: flex-start;
    container-type: size;
}

.social-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    margin-bottom: 12px;
}

/* Brand Colors */
.twitter-bg {
    background: #1DA1F2;
    color: white;
}

.medium-bg {
    background: #000;
    color: white;
}

.linkedin-bg {
    background: #0077b5;
    color: white;
}

.github-bg {
    background: #24292e;
    color: white;
}

.spotify-bg {
    background: #1DB954;
    color: white;
}

.social-info {
    display: flex;
    flex-direction: column;
    margin-bottom: auto;
    /* Pushes button to bottom */
}

.social-name {
    font-weight: 700;
    font-size: 16px;
    margin-bottom: 2px;
}

.social-handle {
    font-size: 14px;
    color: #888;
}

/* Use container queries to adapt layout based on available height */
@container (height < 200px) {
    /* .social-card padding cannot be changed by its own container query */


    .social-icon {
        margin-bottom: 8px;
        width: 40px;
        height: 40px;
        font-size: 20px;
    }

    .action-btn {
        margin-top: 8px;
        padding: 6px 16px;
    }
}

@container (height < 130px) {
    .action-btn {
        display: none;
    }
}

@container (height < 110px) {
    .social-handle {
        display: none;
    }

    .social-name {
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        width: 100%;
    }
}

.action-btn {
    background: var(--btn-bg);
    border: none;
    padding: 8px 24px;
    border-radius: 100px;
    font-weight: 700;
    font-size: 14px;
    cursor: pointer;
    margin-top: 12px;
    color: var(--btn-text);
    transition: background 0.2s;
}

.action-btn:hover {
    background: var(--btn-hover);
}

.green-btn {
    background: #1DB954;
    color: white;
    width: 100%;
}

.green-btn:hover {
    background: #1ed760;
}

.green-light-bg {
    background: #E9FBF0;
}

.img-preview-top {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    overflow: hidden;
}

.bento-grid .card .blog-image {
    object-fit: contain;
    width: 100px;
    height: 100px;
    border-radius: 50% !important;
}

/* Black Theme for ShaderBox */
.black-theme {
    background: #000;
    color: #fff;
}

.green-light-bg {
    background: #E9FBF0;
    color: #111;
    /* Force dark text for legibility */
}

.card-icon-top-right {
    position: absolute;
    top: 20px;
    right: 20px;
    color: rgba(255, 255, 255, 0.7);
    background: rgba(255, 255, 255, 0.1);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}


/* --- TABLET STACKED LAYOUT (Screen 900px - 1024px) --- */
/* Enough width for 820px grid, but Sidebar is still stacked on top */
@media (min-width: 900px) and (max-width: 1023px) {
    .bento-grid {
        max-width: 820px;
        grid-template-columns: repeat(4, 1fr);
    }
}


/* --- DESKTOP START (Side by Side triggers) --- */
@media (min-width: 1024px) {
    body {
        align-items: center;
        padding: 60px;
    }

    .main-wrapper {
        flex-direction: row;
        align-items: flex-start;
    }

    .profile-sidebar {
        width: 350px;
        flex-shrink: 0;
        position: sticky;
        top: 60px;
    }

    /*
       At 1024px, we are side-by-side but we DON'T have 820px width left.
       So the grid naturally falls back to the default (420px max-width).
       It stays 2 columns.
    */
    .bento-grid {
        flex-grow: 1;
        /* No override here, keep defaults */
    }
}

/* --- DESKTOP LARGE (Approx 1350px+) --- */
/* Now we have room for Sidebar + 820px Grid */
@media (min-width: 1350px) {
    .bento-grid {
        max-width: 820px;
        grid-template-columns: repeat(4, 1fr);
    }
}

/* --- Coin Counter --- */
.coin-counter {
    position: fixed;
    top: 20px;
    right: 20px;
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    box-shadow: 0 4px 12px var(--shadow-color);
    border-radius: 50px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 8px;
    font-weight: 700;
    font-size: 18px;
    z-index: 1000;
    transition: transform 0.2s ease;
}

.coin-counter:hover {
    transform: scale(1.05);
}

.coin-icon {
    font-size: 24px;
}

.coin-amount {
    color: var(--text-primary);
    min-width: 30px;
    text-align: left;
}

.coin-counter.bounce {
    animation: coinBounce 0.5s ease;
}

@keyframes coinBounce {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.15);
    }
}

/* --- Slot Machine Card --- */
.slot-machine-card {
    cursor: pointer;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 24px;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.slot-preview {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

.slot-preview-reels {
    display: flex;
    gap: 8px;
    margin-bottom: 8px;
}

.preview-emoji {
    font-size: 40px;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.2));
}

.slot-card-label {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
}

.slot-card-cost {
    font-size: 13px;
    opacity: 0.9;
    font-weight: 500;
}

.slot-machine-card:hover {
    transform: translateY(-4px) scale(1.02);
}

/* --- Slot Machine Modal --- */
.slot-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.slot-modal.active {
    display: flex;
}

.slot-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
}

.slot-modal-content {
    position: relative;
    background: var(--card-bg);
    border-radius: var(--card-radius);
    padding: 40px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    text-align: center;
    animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-30px) scale(0.95);
    }

    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.slot-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--btn-bg);
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    font-size: 28px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: background 0.2s;
}

.slot-close-btn:hover {
    background: var(--btn-hover);
}

.slot-title {
    font-size: 32px;
    font-weight: 800;
    margin-bottom: 32px;
    color: var(--text-primary);
}

.slot-reels {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-bottom: 32px;
}

.slot-reel {
    width: 100px;
    height: 100px;
    background: var(--bg-color);
    border: 3px solid var(--border-color);
    border-radius: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    position: relative;
}

.reel-emoji {
    font-size: 60px;
    transition: transform 0.1s ease;
}

.slot-reel.spinning .reel-emoji {
    animation: reelSpin 0.1s linear infinite;
}

@keyframes reelSpin {
    0% {
        transform: translateY(100%);
    }

    100% {
        transform: translateY(-100%);
    }
}

.slot-spin-btn {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    padding: 16px 48px;
    border-radius: 50px;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.4);
}

.slot-spin-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6);
}

.slot-spin-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
    transform: none;
}

.spin-icon {
    display: inline-block;
    transition: transform 0.3s;
}

.slot-spin-btn:hover .spin-icon {
    transform: rotate(15deg);
}

.slot-message {
    margin-top: 24px;
    font-size: 20px;
    font-weight: 700;
    min-height: 30px;
    color: var(--text-primary);
}

.slot-message.win {
    color: #10b981;
    animation: messageAppear 0.5s ease;
}

.slot-message.lose {
    color: #ef4444;
    animation: messageAppear 0.5s ease;
}

@keyframes messageAppear {
    from {
        opacity: 0;
        transform: scale(0.8);
    }

    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* --- Confetti --- */
.confetti {
    position: fixed;
    font-size: 30px;
    pointer-events: none;
    z-index: 3000;
    animation: confettiFall 3s ease-out forwards;
}

@keyframes confettiFall {
    0% {
        transform: translateY(0) rotate(0deg);
        opacity: 1;
    }

    100% {
        transform: translateY(100vh) rotate(720deg);
        opacity: 0;
    }
}

/* --- Coin Info Modal --- */
.coin-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.coin-modal.active {
    display: flex;
}

.coin-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
}

.coin-modal-content {
    position: relative;
    background: var(--card-bg);
    border-radius: var(--card-radius);
    padding: 40px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    text-align: center;
    animation: modalSlideIn 0.3s ease;
}

.coin-close-btn {
    position: absolute;
    top: 16px;
    right: 16px;
    background: var(--btn-bg);
    border: none;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    font-size: 20px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-primary);
    transition: background 0.2s;
}

.coin-close-btn:hover {
    background: var(--btn-hover);
}

.coin-modal-title {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 16px;
    color: var(--text-primary);
}

.coin-modal-text {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 24px;
}

.coin-modal-icon {
    font-size: 40px;
    color: var(--bio-text);
    opacity: 0.8;
    animation: floatPointer 2s ease-in-out infinite;
}

@keyframes floatPointer {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

/* --- Plant Growing Card --- */
.plant-card {
    cursor: default;
    background: linear-gradient(135deg, #2d8a4e 0%, #1a6b3c 50%, #145230 100%);
    color: white;
    padding: 20px;
    justify-content: center;
    align-items: center;
    text-align: center;
}

.plant-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 100%;
}

.plant-emoji-display {
    font-size: 52px;
    filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.25));
    line-height: 1;
}

.plant-card-label {
    font-size: 16px;
    font-weight: 700;
    letter-spacing: 0.5px;
    margin-bottom: 4px;
}

.plant-stage-label {
    font-size: 13px;
    font-weight: 600;
    opacity: 0.9;
    letter-spacing: 0.3px;
}

.plant-progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255, 255, 255, 0.2);
    border-radius: 100px;
    overflow: hidden;
    margin: 4px 0;
}

.plant-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #6ee7b7, #34d399, #10b981);
    border-radius: 100px;
    transition: width 0.5s ease;
    width: 0%;
}

.plant-time {
    font-size: 12px;
    opacity: 0.85;
    font-weight: 500;
}

.plant-btn {
    background: rgba(255, 255, 255, 0.2);
    backdrop-filter: blur(4px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 16px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, background 0.2s, box-shadow 0.2s;
    margin-top: 4px;
    white-space: nowrap;
}

.plant-btn:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.35);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

.plant-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none;
}

.plant-btn-harvest {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    border-color: rgba(255, 255, 255, 0.4);
    font-size: 13px;
    padding: 10px 20px;
}

.plant-btn-harvest:hover:not(:disabled) {
    background: linear-gradient(135deg, #fbbf24, #f59e0b);
}

.plant-btn-collect {
    background: linear-gradient(135deg, #2d8a4e, #1a6b3c);
    border-color: rgba(255, 255, 255, 0.3);
    font-size: 15px;
    padding: 12px 32px;
    margin-top: 16px;
}

.plant-btn-collect:hover {
    background: linear-gradient(135deg, #34d399, #2d8a4e);
}

/* Plant emoji bounce for ready state */
.plant-emoji-bounce {
    animation: plantBounce 1.5s ease-in-out infinite;
}

@keyframes plantBounce {

    0%,
    100% {
        transform: translateY(0) scale(1);
    }

    50% {
        transform: translateY(-8px) scale(1.1);
    }
}

/* Subtle grow animation for growing state */
.plant-emoji-grow {
    animation: plantGrow 3s ease-in-out infinite;
}

@keyframes plantGrow {

    0%,
    100% {
        transform: scale(1);
    }

    50% {
        transform: scale(1.05);
    }
}

/* --- Harvest Modal --- */
.harvest-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 2000;
    align-items: center;
    justify-content: center;
}

.harvest-modal.active {
    display: flex;
}

.harvest-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(8px);
}

.harvest-modal-content {
    position: relative;
    background: var(--card-bg);
    border-radius: var(--card-radius);
    padding: 48px 40px;
    max-width: 400px;
    width: 90%;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    text-align: center;
    animation: modalSlideIn 0.3s ease;
}

.harvest-emoji {
    font-size: 72px;
    margin-bottom: 16px;
    animation: plantBounce 1.5s ease-in-out infinite;
}

.harvest-title {
    font-size: 24px;
    font-weight: 800;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.harvest-text {
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-secondary);
    margin-bottom: 8px;
}