/* Play Your Cards Right */

:root {
    --game-primary: #C90C0F;
    --game-secondary: #FAB719;
    --pycr-felt: #14532d;
    --pycr-felt-dark: #052e16;
    --card-width: 210px;
    --card-height: 294px;
}

body.pycr-page {
    margin: 0;
    min-height: 100vh;
    font-family: "Rockwell", "Rockwell Nova", "Roboto Slab", serif;
    color: #f8fafc;
    background:
        radial-gradient(circle at 12% 10%, rgba(201, 12, 15, 0.18), transparent 45%),
        radial-gradient(circle at 88% 20%, rgba(250, 183, 25, 0.16), transparent 50%),
        linear-gradient(180deg, #07140c 0%, #0b1f12 55%, #071018 100%);
}

body.pycr-page.game-menu-active {
    overflow-y: auto;
    overflow-x: hidden;
}

body.pycr-page.game-menu-active #game-header {
    display: none !important;
}

.pycr-page .game-screen {
    display: none;
    min-height: 100vh;
}

.pycr-page .game-screen.active {
    display: block;
}

.pycr-shell {
    max-width: min(1720px, 96vw);
    margin: 0 auto;
    padding: 1.25rem 1rem 2.5rem;
}

.pycr-status {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: center;
    margin-bottom: 1rem;
}

.pycr-chip {
    background: rgba(15, 23, 42, 0.72);
    border: 1px solid rgba(250, 183, 25, 0.35);
    color: #f8fafc;
    border-radius: 999px;
    padding: 0.4rem 0.85rem;
    font-size: 0.9rem;
}

.pycr-prompt {
    text-align: center;
    font-size: 1.45rem;
    margin: 0.4rem 0 0.2rem;
    color: #FAB719;
    min-height: 2rem;
}

.pycr-rules-line {
    text-align: center;
    color: #cbd5e1;
    font-size: 0.92rem;
    margin: 0 0 1rem;
    min-height: 1.2rem;
}

.pycr-wall {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 2.2rem 1.5rem 2.4rem;
    border-radius: 22px;
    background:
        radial-gradient(circle at 50% 0%, rgba(250, 183, 25, 0.12), transparent 55%),
        linear-gradient(180deg, var(--pycr-felt) 0%, var(--pycr-felt-dark) 100%);
    box-shadow: inset 0 0 0 4px rgba(250, 183, 25, 0.18), 0 18px 40px rgba(0, 0, 0, 0.45);
    min-height: 420px;
    width: 100%;
    overflow: visible;
}

.pycr-rows {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 1.2rem;
}

.pycr-row {
    display: flex;
    flex-direction: row;
    align-items: flex-end;
    gap: 1rem;
}

.pycr-slot {
    position: relative;
    width: var(--card-width);
    height: var(--card-height);
}

.pycr-wrap-home {
    width: var(--card-width);
    height: var(--card-height);
    visibility: hidden;
    pointer-events: none;
}

.pycr-slot-flying {
    z-index: 30;
}

.pycr-slot.current::after {
    content: '';
    position: absolute;
    inset: -7px;
    border: 3px solid #FAB719;
    border-radius: 12px;
    pointer-events: none;
    box-shadow: 0 0 16px rgba(250, 183, 25, 0.55);
}

.pycr-slot-awaiting {
    opacity: 0;
    visibility: hidden;
}

.pycr-slot-arrived .card {
    animation: pycr-slot-in 0.32s ease;
}

@keyframes pycr-slot-in {
    from {
        transform: translateY(-8px) scale(0.96);
        opacity: 0.35;
    }
    to {
        transform: none;
        opacity: 1;
    }
}

.pycr-slot.correct .card {
    box-shadow: 0 0 0 3px #22c55e;
}

.pycr-slot.wrong .card {
    box-shadow: 0 0 0 3px #ef4444;
}

.pycr-wall .card {
    width: var(--card-width);
    height: var(--card-height);
    color: #111;
    background: #fff;
    font-size: calc(var(--card-width) / 6);
    padding: calc(var(--card-width) * 0.05);
    border-radius: calc(var(--card-width) * 0.07);
    box-sizing: border-box;
    overflow: hidden;
    box-shadow: 2px 4px 10px rgba(0, 0, 0, 0.4);
    transition: transform 0.28s ease, box-shadow 0.28s ease;
}

.pycr-wall .card.hearts,
.pycr-wall .card.diamonds {
    color: #e74c3c;
}

.pycr-wall .card.clubs,
.pycr-wall .card.spades {
    color: #111;
}

.pycr-wall .card .suit {
    font-size: 1em;
}

.pycr-wall .card .corner-top,
.pycr-wall .card .corner-bottom {
    display: block;
    font-size: calc(var(--card-width) * 0.16);
    line-height: 1.05;
    font-weight: 700;
    z-index: 12;
    color: inherit;
}

.pycr-wall .card .corner-top {
    top: calc(var(--card-width) * 0.04);
    left: calc(var(--card-width) * 0.04);
}

.pycr-wall .card .corner-bottom {
    bottom: calc(var(--card-width) * 0.04);
    right: calc(var(--card-width) * 0.04);
}

.pycr-wall .card .corner-top .suit,
.pycr-wall .card .corner-bottom .suit {
    display: block !important;
    font-size: 0.88em;
    line-height: 1;
}

.pycr-wall .card.face-down {
    color: transparent;
    background: #1e3c72 url('/assets/css_graphics/full_deck/cards/images/standard_deck/card_back.png') center / cover no-repeat;
    border: 1px solid #0f172a;
    padding: 0;
}

.pycr-wall .card.face-down .corner-top,
.pycr-wall .card.face-down .corner-bottom,
.pycr-wall .card.face-down .center-symbols {
    display: none;
}

.pycr-wall .card.flipping {
    transform: rotateY(90deg);
}

.pycr-wall .card .center-symbols {
    font-size: 1em;
}

.pycr-wall .card .pip {
    font-size: calc(var(--card-width) * 0.30);
}

.pycr-wall .card.hearts-A .center-symbols::before,
.pycr-wall .card.diamonds-A .center-symbols::before,
.pycr-wall .card.clubs-A .center-symbols::before {
    font-size: calc(var(--card-width) * 0.50);
}

.pycr-wall .card:has(.face-image) {
    display: flex;
    flex-direction: column;
    position: relative;
}

.pycr-wall .card:has(.face-image) .center-symbols {
    position: relative;
    inset: auto;
    flex: 1;
    width: auto;
    height: auto;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    padding: 0;
    margin: 0;
}

.pycr-wall .card .face-image,
.pycr-wall .card img.face-image,
.pycr-wall .card:has(.face-image) .face-image,
.pycr-wall .card:has(.face-image) img.face-image {
    width: 82% !important;
    height: 82% !important;
    min-width: 0 !important;
    min-height: 0 !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    object-position: center !important;
    position: relative !important;
    inset: auto !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
    margin: auto !important;
    padding: 0 !important;
    border-radius: calc(var(--card-width) * 0.04);
    display: block !important;
    box-sizing: border-box !important;
    z-index: 1;
}

.pycr-wall .card.spades-A .face-image,
.pycr-wall .card.spades-A img.face-image {
    width: 72% !important;
    height: 72% !important;
}

.pycr-wall .card.pycr-flyer {
    position: fixed;
    z-index: 40;
    pointer-events: none;
    margin: 0;
    box-shadow: 8px 14px 24px rgba(0, 0, 0, 0.5);
    transition: none;
}

.pycr-wall[data-length="13"] {
    --card-width: 100px;
    --card-height: 140px;
}

.pycr-wall[data-length="8"] {
    --card-width: 132px;
    --card-height: 185px;
}

.pycr-wall[data-length="5"] {
    --card-width: 168px;
    --card-height: 235px;
}

.pycr-controls {
    margin-top: 1.25rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.85rem;
}

.pycr-control-label {
    color: #e2e8f0;
    font-weight: 600;
    margin-right: 0.4rem;
}

.pycr-ace-row,
.pycr-colour-row,
.pycr-guess-row,
.pycr-extra-row {
    display: flex;
    flex-wrap: wrap;
    gap: 0.6rem;
    justify-content: center;
    align-items: center;
}

.pycr-ace-row[hidden],
.pycr-colour-row[hidden],
.pycr-extra-row[hidden],
.pycr-btn[hidden] {
    display: none !important;
}

.pycr-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    min-width: 7.5rem;
    padding: 0.75rem 1.2rem;
    border-radius: 10px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    border: 2px solid transparent;
    font-family: inherit;
}

.pycr-btn:disabled {
    opacity: 0.45;
    cursor: not-allowed;
}

.pycr-btn-higher {
    background: #C90C0F;
    color: #fff;
    border-color: #C90C0F;
}

.pycr-btn-higher:hover:not(:disabled) {
    background: #a00a0c;
    color: #fff;
}

.pycr-btn-lower {
    background: #1e3a8a;
    color: #fff;
    border-color: #1e3a8a;
}

.pycr-btn-lower:hover:not(:disabled) {
    background: #172554;
    color: #fff;
}

.pycr-btn-same {
    background: #fff;
    color: #C90C0F;
    border-color: #C90C0F;
}

.pycr-btn-same:hover:not(:disabled) {
    background: #C90C0F;
    color: #fff;
}

.pycr-btn-gold {
    background: #FAB719;
    color: #1a1a1a;
    border-color: #FAB719;
}

.pycr-btn-gold:hover:not(:disabled) {
    background: #e0a40f;
    color: #1a1a1a;
}

.pycr-btn-outline {
    background: #fff;
    color: #C90C0F;
    border-color: #C90C0F;
}

.pycr-btn-outline:hover:not(:disabled) {
    background: #C90C0F;
    color: #fff;
}

.pycr-btn-red {
    background: #fff;
    color: #C90C0F;
    border: 2px solid #C90C0F;
}

.pycr-btn-red.selected,
.pycr-btn-red:hover:not(:disabled) {
    background: #C90C0F;
    color: #fff;
}

.pycr-btn-black {
    background: #fff;
    color: #1a1a1a;
    border: 2px solid #1a1a1a;
}

.pycr-btn-black.selected,
.pycr-btn-black:hover:not(:disabled) {
    background: #1a1a1a;
    color: #fff;
}

.landscape-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 20000;
    background: rgba(7, 20, 12, 0.96);
    color: #fff;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 2rem;
}

.landscape-overlay.show {
    display: flex;
}

.landscape-icon {
    font-size: 3rem;
    color: #FAB719;
    margin-bottom: 1rem;
}

.modal {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.72);
    z-index: 12000;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

.modal.active {
    display: flex;
}

.modal-content {
    background: #fff;
    color: #1a1a1a;
    border-radius: 1rem;
    max-width: 640px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.modal-large {
    max-width: 760px;
}

.modal-header,
.modal-footer {
    padding: 1.1rem 1.4rem;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
}

.modal-header {
    border-bottom: 2px solid #eee;
}

.modal-header h2 {
    margin: 0;
    color: #C90C0F;
    font-size: 1.35rem;
}

.modal-close {
    background: #fff;
    border: 2px solid #C90C0F;
    color: #C90C0F;
    border-radius: 8px;
    cursor: pointer;
    padding: 0.35rem 0.55rem;
}

.modal-close:hover {
    background: #C90C0F;
    color: #fff;
}

.modal-body {
    padding: 1.2rem 1.4rem;
}

.modal-footer {
    border-top: 2px solid #eee;
    justify-content: flex-end;
}

.help-section {
    margin-bottom: 1.1rem;
}

.help-section h3 {
    color: #C90C0F;
    margin: 0 0 0.4rem;
}

.help-section ul {
    margin: 0;
    padding-left: 1.2rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(130px, 1fr));
    gap: 0.8rem;
    margin-bottom: 1.2rem;
}

.stat-card {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 0.6rem;
    padding: 1rem;
    text-align: center;
}

.stat-value {
    font-size: 1.7rem;
    font-weight: 700;
    color: #C90C0F;
}

.stat-label {
    color: #475569;
    font-size: 0.85rem;
}

.difficulty-stats {
    display: grid;
    gap: 0.45rem;
    color: #334155;
}

.win-stats {
    display: flex;
    gap: 1rem;
    justify-content: center;
    margin-top: 1rem;
}

.win-stat {
    text-align: center;
}

.win-stat strong {
    display: block;
    font-size: 1.4rem;
    color: #C90C0F;
}

.win-stat span {
    color: #64748b;
    font-size: 0.85rem;
}

.result-message {
    text-align: center;
    font-size: 1.1rem;
}

.pycr-page .btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.65rem 1.1rem;
    border-radius: 8px;
    font-weight: 700;
    cursor: pointer;
    border: 2px solid transparent;
    font-family: inherit;
}

.pycr-page .btn-primary {
    background: #C90C0F;
    color: #fff;
    border-color: #C90C0F;
}

.pycr-page .btn-primary:hover {
    background: #a00a0c;
    color: #fff;
}

.pycr-page .btn-secondary {
    background: #fff;
    color: #C90C0F;
    border-color: #C90C0F;
}

.pycr-page .btn-secondary:hover {
    background: #C90C0F;
    color: #fff;
}

@media (prefers-reduced-motion: reduce) {
    .pycr-slot-awaiting {
        opacity: 1;
    }

    .pycr-slot-arrived .card {
        animation: none;
    }

    .pycr-wall .card.flipping {
        transform: none;
    }
}

@media (max-width: 768px) {
    :root,
    .pycr-wall[data-length="8"],
    .pycr-wall[data-length="13"],
    .pycr-wall[data-length="5"] {
        --card-width: 86px;
        --card-height: 120px;
    }

    .pycr-prompt {
        font-size: 1.15rem;
    }

    .pycr-btn {
        min-width: 6.2rem;
        padding: 0.65rem 0.9rem;
        font-size: 0.95rem;
    }

    body.with-game-header .pycr-shell {
        padding-top: 0.5rem;
    }
}
