/* /content/games/solitare/style.css */

:root {
    --bg: #006b3a;
    /* more classic table green */
    --bg-alt: #005430;

    /* Card size scales with viewport width */
    --card-width: clamp(40px, 11vw, 72px);
    --card-height: calc(var(--card-width) * 1.45);
    --tableau-offset: calc(var(--card-height) * 0.20);

    --card-border: rgba(15, 23, 42, 0.18);
    --card-highlight: #22c55e;
    --text: #e5e7eb;
    --muted: #9ca3af;
    --accent: #22c55e;
    --accent-soft: rgba(34, 197, 94, 0.15);
    --danger: #ef4444;
    --radius-lg: 18px;
    --radius-card: 8px;
    --shadow-soft: 0 24px 60px rgba(15, 23, 42, 0.7);
    --shadow-card: 0 10px 26px rgba(15, 23, 42, 0.65);
    --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "SF Pro Text", sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

body.sol-body {
    margin: 0;
    min-height: 100vh;
    font-family: var(--font-sans);
    background: radial-gradient(circle at top, #0f766e 0, #064e3b 30%, #022c22 60%, #000 100%);
    color: var(--text);
}

/* Root wrapper for fullscreen */
.game-root {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Header */
.sol-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-bottom: 1px solid rgba(15, 118, 110, 0.7);
    backdrop-filter: blur(16px) saturate(130%);
    background: linear-gradient(to bottom,
            rgba(6, 95, 70, 0.95),
            rgba(6, 78, 59, 0.9));
    position: sticky;
    top: 0;
    z-index: 20;
}

.sol-header-left h1 {
    margin: 0 0 2px;
    font-size: 18px;
    letter-spacing: 0.04em;
}

.sol-header-left p {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
}

.sol-header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

/* Stats */
.sol-stat {
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    min-width: 56px;
}

.sol-stat .label {
    font-size: 10px;
    text-transform: uppercase;
    color: var(--muted);
    letter-spacing: 0.08em;
}

.sol-stat .value {
    font-size: 16px;
    font-weight: 600;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.5);
    background: rgba(15, 23, 42, 0.9);
    color: var(--text);
    font-size: 11px;
    cursor: pointer;
    text-decoration: none;
    white-space: nowrap;
    transition:
        transform 0.08s ease,
        box-shadow 0.12s ease,
        border-color 0.12s ease,
        background 0.12s ease;
}

.btn.primary {
    background: radial-gradient(circle at top, #22c55e, #16a34a);
    border-color: rgba(74, 222, 128, 0.9);
    color: #052e16;
    font-weight: 600;
    box-shadow: 0 12px 28px rgba(34, 197, 94, 0.45);
}

.btn.danger {
    background: radial-gradient(circle at top, #ef4444, #b91c1c);
    border-color: rgba(248, 113, 113, 0.9);
    color: #fef2f2;
    font-weight: 600;
    box-shadow: 0 12px 28px rgba(248, 113, 113, 0.45);
}

.btn:hover {
    transform: translateY(-1px);
    border-color: rgba(148, 163, 184, 0.8);
}

.btn.primary:hover {
    border-color: rgba(190, 242, 100, 1);
}

.btn.danger:hover {
    border-color: rgba(254, 202, 202, 1);
}

/* Menu button (hamburger) */
.menu-btn {
    width: 30px;
    height: 30px;
    padding: 0;
    font-size: 18px;
    line-height: 1;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Layout */
.sol-main {
    flex: 1;
    display: grid;
    grid-template-columns: minmax(0, 3fr) minmax(260px, 1fr);
    gap: 16px;
    padding: 10px 12px 18px;
    max-width: 1200px;
    margin: 0 auto;
}

/* Board with green glass look */
.sol-board {
    background: radial-gradient(circle at top, rgba(6, 95, 70, 0.9), rgba(3, 53, 34, 0.95));
    backdrop-filter: blur(18px) saturate(120%);
    -webkit-backdrop-filter: blur(18px) saturate(120%);
    border-radius: var(--radius-lg);
    border: 1px solid rgba(15, 118, 110, 0.7);
    box-shadow: var(--shadow-soft);
    padding: 10px 10px 12px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* Top row: stock + foundations */
.sol-top-row {
    display: grid;
    grid-template-columns: minmax(200px, 1.2fr) minmax(0, 2fr);
    gap: 10px;
}

/* Stock area */
.stock-area {
    border-radius: 14px;
    border: 1px solid rgba(22, 163, 74, 0.6);
    padding: 8px 8px;
    display: flex;
    flex-direction: column;
    gap: 6px;
    align-content: flex-start;
    background: linear-gradient(150deg,
            rgba(4, 120, 87, 0.75),
            rgba(6, 78, 59, 0.8));
    backdrop-filter: blur(14px) saturate(130%);
}

.stock-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 8px;
}

.stock-hint {
    margin: 2px 0 0;
    font-size: 11px;
    color: var(--muted);
}

.pile-label {
    font-size: 10px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--muted);
}

/* stock down + up row */
.stock-piles {
    margin-top: 6px;
    display: flex;
    gap: 8px;
    align-items: flex-start;
}

/* Foundations area */
.foundation-area {
    border-radius: 14px;
    border: 1px solid rgba(22, 163, 74, 0.6);
    padding: 8px 8px;
    background: linear-gradient(145deg,
            rgba(5, 122, 85, 0.8),
            rgba(4, 85, 61, 0.9));
    backdrop-filter: blur(14px) saturate(130%);
}

.foundation-header {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    gap: 10px;
}

.foundation-header h2 {
    margin: 0;
    font-size: 13px;
}

.foundation-header p {
    margin: 0;
    font-size: 11px;
    color: var(--muted);
}

.foundation-row {
    margin-top: 6px;
    display: flex;
    gap: 8px;
}

/* Bottom row: tableau */
.sol-bottom-row {
    border-radius: 14px;
    border: 1px solid rgba(22, 163, 74, 0.7);
    padding: 8px 8px 10px;
    background: linear-gradient(170deg,
            rgba(5, 122, 85, 0.8),
            rgba(3, 64, 46, 0.9));
    backdrop-filter: blur(18px);
}

.tableau-header h2 {
    margin: 0;
    font-size: 13px;
}

.tableau-header p {
    margin: 2px 0 6px;
    font-size: 11px;
    color: var(--muted);
}

.tableau {
    display: grid;
    grid-template-columns: repeat(7, minmax(0, 1fr));
    gap: 6px;
}

.tableau-col {
    min-height: calc(var(--card-height) + var(--tableau-offset) * 4);
    border-radius: 10px;
    border: 1px dashed rgba(21, 128, 61, 0.6);
    padding: 4px;
    position: relative;
    background: rgba(4, 47, 39, 0.85);
    backdrop-filter: blur(14px);
}

/* Common pile styles */
.pile {
    width: var(--card-width);
    height: var(--card-height);
    border-radius: var(--radius-card);
    border: 1px solid rgba(15, 23, 42, 0.25);
    background: #0f172a;
    box-shadow: var(--shadow-card);
    position: relative;
    overflow: hidden;
}

/* Stock design with stack + badge (left) */
.stock-pile {
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.stock-pile::before,
.stock-pile::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: repeating-linear-gradient(45deg,
            #0369a1,
            #0369a1 6px,
            #075985 6px,
            #075985 12px);
    opacity: 0.95;
    pointer-events: none;
}

.stock-pile::after {
    inset: 4px 6px;
    border-radius: calc(var(--radius-card) - 4px);
    border: 1px solid rgba(59, 130, 246, 0.8);
    opacity: 0.7;
}

.stock-pile.disabled::before,
.stock-pile.disabled::after {
    opacity: 0.2;
}

/* Shown cards (right) – fan up to 3 cards side-by-side */
.stock-up-pile {
    position: relative;
    overflow: visible;
    width: calc(var(--card-width) + 24px);
    /* room to fan 3 cards */
    background: transparent;
    border-radius: var(--radius-card);
    border: 1px dashed rgba(15, 23, 42, 0.25);
    box-shadow: none;
}

.stock-up-pile.empty {
    border-style: dashed;
}

.stock-up-pile .card {
    position: absolute;
    /* JS sets left offset for fanning */
}

/* count badges */
.pile-count {
    position: absolute;
    bottom: 4px;
    right: 4px;
    padding: 2px 6px;
    border-radius: 999px;
    background: rgba(15, 23, 42, 0.9);
    border: 1px solid rgba(148, 163, 184, 0.7);
    font-size: 10px;
    color: var(--muted);
}

/* Cards – classic white face */
.card {
    width: var(--card-width);
    height: var(--card-height);
    border-radius: var(--radius-card);
    background: radial-gradient(circle at top, #ffffff, #f9fafb);
    border: 1px solid var(--card-border);
    box-shadow: var(--shadow-card);
    position: relative;
    cursor: pointer;
    transition:
        transform 0.08s ease,
        box-shadow 0.12s ease,
        border-color 0.12s ease,
        background 0.12s ease;
}

.tableau-col .card {
    position: absolute;
    left: 4px;
}

/* Stacking offset for tableau */
.tableau-col .card {
    transform-origin: top left;
}

/* Face-down cards: blue patterned back */
.card.face-down {
    background: repeating-linear-gradient(45deg,
            #0369a1,
            #0369a1 6px,
            #075985 6px,
            #075985 12px);
    border-color: rgba(37, 99, 235, 0.9);
}

.card.face-down .card-rank,
.card.face-down .card-suit,
.card.face-down .card-center {
    visibility: hidden;
}

/* Red/black suits */
.card.red {
    color: #dc2626;
}

.card.black {
    color: #0f172a;
}

/* Rank/suit layout */
.card-rank,
.card-suit {
    position: absolute;
    font-size: 14px;
    font-weight: 600;
}

.card-rank {
    top: 4px;
    left: 6px;
}

.card-suit {
    bottom: 4px;
    right: 6px;
}

.card-center {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

/* Hover/selection */
.card.face-up:hover {
    transform: translateY(-2px);
    box-shadow: 0 18px 38px rgba(15, 23, 42, 0.9);
    border-color: rgba(74, 222, 128, 0.9);
}

.card.selected {
    outline: 2px solid var(--card-highlight);
    outline-offset: 2px;
    box-shadow:
        0 0 0 1px rgba(34, 197, 94, 0.6),
        0 20px 40px rgba(34, 197, 94, 0.3);
}

/* Empty piles/columns */
.pile.empty::after,
.tableau-col.empty::after {
    content: "";
    position: absolute;
    inset: 3px;
    border-radius: inherit;
    border: 1px dashed rgba(148, 163, 184, 0.7);
    opacity: 0.7;
}

/* Sidebar */
.sol-sidebar {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.sol-card-preview {
    background: linear-gradient(145deg,
            rgba(15, 23, 42, 0.9),
            rgba(15, 23, 42, 0.8));
    border-radius: var(--radius-lg);
    border: 1px solid rgba(148, 163, 184, 0.4);
    box-shadow: var(--shadow-soft);
    padding: 12px 12px 14px;
}

.preview-img {
    width: 100%;
    border-radius: 14px;
    display: block;
    margin-bottom: 8px;
}

.sol-tip {
    margin: 0;
    font-size: 12px;
    color: var(--muted);
}

/* ========= MODE POPUP ========= */
.mode-overlay {
    position: fixed;
    inset: 0;
    z-index: 70;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mode-overlay.hidden {
    display: none;
}

.mode-backdrop {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top,
            rgba(5, 30, 20, 0.78),
            rgba(0, 0, 0, 0.96));
    backdrop-filter: blur(14px);
}

.mode-dialog {
    position: relative;
    z-index: 71;
    max-width: 420px;
    width: calc(100% - 40px);
    background: radial-gradient(circle at top, #020617, #020617);
    border-radius: 22px;
    border: 1px solid rgba(34, 197, 94, 0.9);
    box-shadow: 0 32px 80px rgba(2, 6, 23, 0.98);
    padding: 20px 18px 22px;
    text-align: center;
}

.mode-title {
    margin: 0 0 8px;
    font-size: 18px;
}

.mode-desc {
    margin: 0 0 14px;
    font-size: 13px;
    color: var(--muted);
}

.mode-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.mode-btn {
    flex: 1 1 140px;
}

/* ========= PAUSE MENU ========= */
.pause-overlay {
    position: fixed;
    inset: 0;
    z-index: 60;
    display: none;
}

.pause-overlay.visible {
    display: flex;
    align-items: center;
    justify-content: center;
}

.pause-backdrop {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top,
            rgba(5, 30, 20, 0.75),
            rgba(0, 0, 0, 0.95));
    backdrop-filter: blur(12px);
}

.pause-dialog {
    position: relative;
    z-index: 61;
    max-width: 420px;
    width: calc(100% - 40px);
    background: radial-gradient(circle at top, #020617, #020617);
    border-radius: 20px;
    border: 1px solid rgba(34, 197, 94, 0.8);
    box-shadow: 0 28px 80px rgba(2, 6, 23, 0.98);
    padding: 18px 18px 20px;
    text-align: center;
}

.pause-title {
    margin: 0 0 12px;
    font-size: 18px;
}

.pause-btn {
    width: 100%;
    margin-top: 8px;
    padding: 8px 12px;
}

/* ========= AD OVERLAY ========= */
.ad-overlay {
    position: fixed;
    inset: 0;
    z-index: 80;
    /* above pause (60) and mode (70) */
    display: none;
}

.ad-overlay.visible {
    display: flex;
    align-items: center;
    justify-content: center;
}

.ad-backdrop {
    position: absolute;
    inset: 0;
    background: radial-gradient(circle at top,
            rgba(5, 30, 20, 0.72),
            rgba(2, 6, 8, 0.96));
    backdrop-filter: blur(10px);
}

.ad-dialog {
    position: relative;
    z-index: 81;
    max-width: 620px;
    width: calc(100% - 32px);
    margin: 60px auto;
    background: radial-gradient(circle at top, #020617, #020617);
    border-radius: 20px;
    border: 1px solid rgba(34, 197, 94, 0.8);
    box-shadow: 0 28px 80px rgba(2, 6, 23, 0.98);
    padding: 18px 18px 20px;
}

.ad-title {
    margin: 0 0 6px;
    font-size: 18px;
}

.ad-desc {
    margin: 0 0 12px;
    font-size: 13px;
    color: var(--muted);
}

.ad-frame-wrapper {
    border-radius: 16px;
    overflow: hidden;
    border: 1px solid rgba(148, 163, 184, 0.7);
    background: #020617;
    margin-bottom: 12px;
}

#ad-frame {
    width: 100%;
    min-height: 120px;
    display: block;
}

.ad-close {
    position: absolute;
    top: 10px;
    right: 10px;
    border-radius: 999px;
    border: 1px solid rgba(148, 163, 184, 0.6);
    background: rgba(10, 24, 18, 0.98);
    color: var(--muted);
    width: 28px;
    height: 28px;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
}

.ad-close:hover {
    color: #fca5a5;
    border-color: rgba(239, 68, 68, 0.8);
}

.ad-continue {
    width: 100%;
}

/* Utility */
.hidden {
    display: none !important;
}

/* Fullscreen tweaks */
:fullscreen .sol-header {
    border-radius: 0;
}

:fullscreen .sol-main {
    max-width: 100%;
}

/* Responsive */
@media (max-width: 900px) {
    .sol-main {
        grid-template-columns: minmax(0, 1fr);
        gap: 10px;
    }

    .sol-sidebar {
        order: -1;
    }

    .sol-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 6px;
    }

    .sol-header-right {
        align-self: stretch;
        justify-content: flex-start;
        flex-wrap: wrap;
    }

    .sol-top-row {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 640px) {
    :root {
        --card-width: clamp(32px, 10vw, 48px);
        --card-height: calc(var(--card-width) * 1.45);
        --tableau-offset: calc(var(--card-height) * 0.18);
    }

    .sol-main {
        padding: 8px;
    }

    .sol-board {
        padding: 6px;
    }

    .tableau {
        gap: 4px;
    }

    .tableau-col {
        padding: 2px;
    }

    .sol-sidebar {
        display: none;
        /* hide tips image on phones to give space to cards */
    }

    .sol-header-left p {
        display: none;
    }
}