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

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    background: #0f0f1a;
    color: #e0e0e0;
    min-height: 100vh;
}

main {
    max-width: 900px;
    margin: 0 auto;
    padding: 1rem;
}

.breadcrumb { font-size: 0.85rem; color: #888; margin-bottom: 0.75rem; }
.breadcrumb a { color: #4ecca3; text-decoration: none; }
.breadcrumb a:hover { text-decoration: underline; }

h1 { text-align: center; color: #4ecca3; font-size: 1.75rem; margin-bottom: 1rem; }

/* ── Game container ─────────────────────────────────── */

.game-container {
    background: #145214;
    border-radius: 12px;
    border: 1px solid #1a6e1a;
    padding: 0.75rem;
    margin-bottom: 2rem;
    position: relative;
    overflow: hidden;
}

/* ── Top bar ────────────────────────────────────────── */

.top-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.top-left { display: flex; gap: 1rem; }
.top-right { display: flex; align-items: center; gap: 0.5rem; margin-left: auto; }

.stat-item { display: flex; flex-direction: column; align-items: center; }
.stat-label { font-size: 0.7rem; color: #9de09d; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-value { font-size: 1rem; font-weight: 700; color: #fff; }

.mode-btns { display: flex; gap: 0.25rem; }
.mode-btn {
    padding: 0.3rem 0.6rem;
    font-size: 0.8rem;
    background: rgba(0,0,0,0.3);
    color: #9de09d;
    border: 1px solid #2a6a2a;
    border-radius: 4px;
    cursor: pointer;
    transition: background 0.15s;
}
.mode-btn.active { background: #1a3a1a; color: #4ecca3; border-color: #4ecca3; }
.mode-btn:hover:not(.active) { background: rgba(0,0,0,0.5); }

.icon-btn {
    width: 32px; height: 32px;
    background: rgba(0,0,0,0.3);
    color: #9de09d;
    border: 1px solid #2a6a2a;
    border-radius: 4px;
    cursor: pointer;
    font-size: 1.1rem;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s;
}
.icon-btn:hover:not(:disabled) { background: rgba(0,0,0,0.5); }
.icon-btn:disabled { opacity: 0.3; cursor: not-allowed; }

.deal-btn, .new-game-btn {
    padding: 0.3rem 0.75rem;
    font-size: 0.85rem;
    font-weight: 600;
    border-radius: 4px;
    border: 1px solid;
    cursor: pointer;
    transition: background 0.15s;
}
.deal-btn {
    background: rgba(0,0,0,0.3);
    color: #f0a000;
    border-color: #f0a000;
}
.deal-btn:hover:not(:disabled) { background: #f0a000; color: #0f0f1a; }
.deal-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.new-game-btn {
    background: rgba(0,0,0,0.3);
    color: #9de09d;
    border-color: #2a6a2a;
}
.new-game-btn:hover { background: rgba(0,0,0,0.5); }

/* ── Tableau ────────────────────────────────────────── */

.tableau {
    display: flex;
    gap: 4px;
    align-items: flex-start;
    min-height: 400px;
    position: relative;
}

.column {
    flex: 1;
    min-width: 0;
    position: relative;
    min-height: 120px;
}

.column.drop-target { outline: 2px dashed #4ecca3; border-radius: 4px; }

/* ── Cards ──────────────────────────────────────────── */

.card {
    position: absolute;
    width: 100%;
    height: 90px;
    background: #f5f5f0;
    border-radius: 5px;
    border: 1px solid #ccc;
    box-shadow: 1px 2px 4px rgba(0,0,0,0.4);
    cursor: pointer;
    user-select: none;
    transition: transform 0.1s;
    font-family: Georgia, serif;
}

.card.face-down {
    background: #1a3a7a;
    border-color: #2a4a9a;
    background-image: repeating-linear-gradient(
        45deg,
        rgba(255,255,255,0.04) 0px,
        rgba(255,255,255,0.04) 2px,
        transparent 2px,
        transparent 8px
    );
    cursor: default;
}

.card.selected {
    outline: 2px solid #4ecca3;
    z-index: 10;
}

.card-inner {
    padding: 3px 5px;
    display: flex;
    flex-direction: column;
    height: 100%;
}

.card-rank {
    font-size: 0.9rem;
    font-weight: 700;
    line-height: 1;
}

.card-suit {
    font-size: 1.1rem;
    line-height: 1;
    margin-top: 1px;
}

.card.red { color: #cc2222; }
.card.black { color: #111; }

/* ── Stacking offsets ───────────────────────────────── */

/* JS sets top via inline style */

/* ── Win overlay ────────────────────────────────────── */

.overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.75);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    border-radius: 12px;
    z-index: 100;
}

.overlay.hidden { display: none; }

.over-title { font-size: 2rem; font-weight: 700; color: #4ecca3; }
.over-sub { font-size: 1.1rem; color: #e0e0e0; }
.over-moves { font-size: 0.95rem; color: #888; }

.action-btn {
    padding: 0.6rem 1.4rem;
    font-size: 1rem;
    font-weight: 600;
    border-radius: 6px;
    border: 2px solid;
    cursor: pointer;
}
.action-btn.primary { background: #4ecca3; color: #0f0f1a; border-color: #4ecca3; }
.action-btn.primary:hover { background: #3db892; border-color: #3db892; }
.action-btn.secondary { background: transparent; color: #e0e0e0; border-color: #4a4a6e; }
.action-btn.secondary:hover { background: #2a2a4e; }

/* ── SEO content ────────────────────────────────────── */

.content {
    padding-top: 1.5rem;
    border-top: 1px solid #2a2a4e;
}
.last-updated { font-size: 0.8rem; color: #555; margin-bottom: 0.75rem; }
.content h2 { color: #4ecca3; font-size: 1.25rem; margin: 1.5rem 0 0.75rem; }
.content h2:first-of-type { margin-top: 1rem; }
.content p { margin-bottom: 0.75rem; color: #c0c0c0; }
.content ul { margin: 0.5rem 0 1rem 1.5rem; color: #c0c0c0; }
.content li { margin-bottom: 0.5rem; }
.faq { margin: 0.5rem 0 1.5rem; }
.faq dt { font-weight: 700; color: #e0e0e0; margin-top: 1rem; }
.faq dd { color: #aaa; margin-left: 0; margin-top: 0.25rem; }

.related-games { margin-top: 1.5rem; }
.related-games h3 { color: #4ecca3; font-size: 1rem; margin-bottom: 0.75rem; }
.game-links { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.game-links a {
    display: inline-block;
    padding: 0.4rem 0.85rem;
    background: #1a1a2e;
    color: #4ecca3;
    border: 1px solid #2a2a4e;
    border-radius: 4px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: background 0.2s, border-color 0.2s;
}
.game-links a:hover { background: #2a2a4e; border-color: #4ecca3; }

/* ── Responsive ─────────────────────────────────────── */

@media (min-width: 600px) {
    main { padding: 2rem; }
    h1 { font-size: 2rem; }
    .card { height: 100px; }
    .card-rank { font-size: 1rem; }
    .card-suit { font-size: 1.25rem; }
}

@media (max-width: 500px) {
    .tableau { gap: 2px; }
    .card { height: 70px; border-radius: 3px; }
    .card-rank { font-size: 0.7rem; }
    .card-suit { font-size: 0.85rem; }
    .top-bar { gap: 0.25rem; }
}
