@import url('/style-guide.css');

@keyframes flip {
    0% {
        transform: matrix(.05, 0, 0, 1, 0, 0)
    }
}

@keyframes move {
    to {
        transform: none
    }
}

a {
    text-underline-offset: .1em
}

a:hover {
    text-underline-offset: .2em
}

a:active {
    text-underline-offset: .05em
}

button {
    font-family: inherit;
    font-size: inherit
}

button:enabled {
    cursor: pointer;
    touch-action: manipulation;
    user-select: none
}

button:focus-visible,
input[type=number]:focus-visible,
input[type=radio]:focus-visible {
    outline: 2px dashed var(--color-blue);
    outline-offset: 1px;
    z-index: 1
}

button:focus-visible:active {
    outline-offset: 0;
    outline-style: solid
}

button:focus:not(:focus-visible) {
    outline: 0
}

input[type=number]:focus-visible:invalid {
    outline-color: #730
}

body,
html {
    -ms-scroll-chaining: none;
    overscroll-behavior: contain
}

body {
    text-align: center
}

.fix100,
.fix100>body {
    height: 100%
}


#body {
    color: var(--color-text-on-deep);
    contain: style layout;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
    overflow: auto
}

#board {
    contain: style layout;
    display: block;
    flex: 1 0 auto
}

.status {
    font-weight: 500
}

.status_alert {
    color: var(--color-warn)
}

body:has(.board_won)>aside {
    transform: none
}

.board_won>#stockwastefound,
.board_won>#tableau {
    display: none
}

.status_won {
    animation: zoomin .8s ease-out;
    display: inline-block;
    font-size: 2.2em;
    font-weight: 700;
    letter-spacing: 1px;
    line-height: 1;
    margin: 0 auto .75em
}

.endresults {
    animation: fadein 1s 1.25s forwards;
    margin: 0 auto;
    opacity: 0
}

.endresults__replay {
    margin-top: 1.5em
}

#metagame {
    bottom: 0;
    contain: style layout;
    position: fixed;
    position: sticky;
    width: 100%;
    z-index: 40
}

.ingame-status {
    margin: .25em auto 3px;
    padding: .25em .5em;
    width: fit-content
}

.button__label {
    pointer-events: none
}

/* Auto-play buttons live inline inside status text */
.ingame-status .game-button {
    font-size: .85em;
    margin: .25em .15em;
    vertical-align: middle
}

#controls .game-button {
    align-items: center;
    display: flex;
    gap: .45em;
    white-space: nowrap
}

.game-button:disabled {
    opacity: .5;
    pointer-events: none
}

.ico {
    contain: strict;
    fill: none;
    height: 1.15em;
    stroke: currentcolor;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-width: 3;
    width: 1.15em
}

.ico__path_animatable {
    transform-origin: 50%;
    transition: transform .1s ease-out
}

#new:active .ico__path_animatable {
    transform: rotate(90deg)
}

#hint:active .ico__path_animatable {
    transform: scale(1.1)
}

#undo:active .ico__path_animatable {
    transform: rotate(-50grad)
}

#stockwastefound,
#tableau {
    contain: style size;
    touch-action: manipulation;
    user-select: none;
    visibility: hidden
}

#stockwastefound {
    display: flex
}

#foundations {
    contain: style size;
    display: flex;
    flex: 1;
    height: 100%;
    justify-content: flex-end
}

.card,
.pile,
.pile-with-placeholder::before {
    border-radius: 2.5px
}

.card,
.pile-with-placeholder::before {
    box-sizing: border-box;
    contain: strict;
    display: inline-block;
    left: 0;
    position: absolute;
    top: 0
}

.pile-with-placeholder::before {
    border: 1px solid #999;
    content: ""
}

.pile {
    /* JS-injected sizing (onResize) sets width + padding expecting content-box;
       the style-guide's global border-box reset would collapse the column gaps */
    box-sizing: content-box;
    contain: style size;
    display: inline-block;
    height: 100%;
    position: relative;
}

#foundations .pile::before {
    background-color: #cecece;
}

.pile_drophover {
    background: rgba(255, 255, 255, .18)
}

.stock-pile {
    cursor: pointer;
    pointer-events: none;
}

.stock-pile_enabled {
    pointer-events: auto
}

.stock-pile_enabled::before {
    box-shadow: 0 2px 1px rgba(0, 0, 0, .2);
    color: transparent;
    content: "↪︎"
}

.stock-pile_enabled:empty::before {
    box-shadow: none;
    color: var(--color-text-on-deep);
    content: "↶"
}

.stock-pile_enabled:active::before {
    background: rgba(0, 0, 0, .2);
    box-shadow: none
}

.stock-pile_enabled:empty:hover::before {
    box-shadow: inset 0 0 5px rgba(255, 255, 255, .35)
}

.card {
    background:
        repeating-linear-gradient(45deg, rgba(255, 255, 255, .13) 0 1px, transparent 1px 18px),
        repeating-linear-gradient(-45deg, rgba(255, 255, 255, .13) 0 1px, transparent 1px 18px),
        linear-gradient(160deg, var(--color-blue) 0%, var(--color-blue-dark) 100%);

    border: .5px solid #fdfdfe;
    pointer-events: none;
    touch-action: manipulation
}

.card_visible {
    background: #fdfdfe;
    border-color: #bbb;
    pointer-events: auto
}

.card_visible:last-child {
    border-bottom-color: #999
}

@media (min-height:30em) and (min-width:28em) {
    .card_visible:last-child {
        border-bottom-color: #bbb;
        box-shadow: 0 1px 3px rgba(0, 0, 0, .2)
    }
}

.card-face {
    color: #000;
    contain: strict;
    display: none;
    height: 100%;
    pointer-events: none;
    position: relative;
    user-select: none;
    width: 100%
}

.card_visible>.card-face,
dialog[open] {
    display: block
}

.card-face_red {
    color: #e71007
}

.cc {
    align-items: center;
    display: flex;
    gap: .12em;
    line-height: 1;
    position: absolute;
    text-align: center
}

.cc b,
.cc span {
    font-weight: 600
}

.cc span { font-size: .9em }

.cc {
    top: 3%;
    left: 5%
}

.cc--br {
    bottom: 3%;
    left: auto;
    right: 5%;
    top: auto;
    transform: rotate(180deg)
}

.pip {
    line-height: 1;
    position: absolute;
    transform: translate(-50%, -50%)
}

.pip--ace {
    left: 50%;
    top: 50%
}

.card-face-letter {
    font-weight: 700;
    left: 50%;
    line-height: 1;
    position: absolute;
    top: 50%;
    transform: translate(-50%, -50%)
}

.card.err,
.err:empty::before,
.err>.card:last-child {
    background: #f98;
    border-style: dotted
}

#stock.err>.card:last-child {
    background: #f98b;
    outline: 1.5px #730 solid
}

.board_grabbing .card_visible,
.board_grabbing .stock-pile_enabled,
.board_won .card_visible,
.card_moving {
    pointer-events: none !important
}

.waste-pile>.card_visible {
    pointer-events: none
}

.waste-pile>.card_visible:last-child {
    pointer-events: auto
}

.card_will-flip {
    will-change: transform;
    z-index: 1
}

.card_grabbed,
.card_moving {
    z-index: 50
}

.card_flipping {
    animation: flip .25s
}

.fast {
    animation-duration: .15s
}


dialog[open]+.backdrop {
    backdrop-filter: blur(2px);
    background: rgba(0, 0, 0, .9);
    height: 150%;
    left: 0;
    overflow: hidden;
    position: fixed;
    top: 0;
    width: 100%;
    z-index: 90
}

dialog {
    display: none
}

.card-value-2 .pip:nth-of-type(1) {
    left: 50%;
    top: 33%
}

.card-value-2 .pip:nth-of-type(2) {
    left: 50%;
    top: 66%
}

.card-value-3 .pip:nth-of-type(1) {
    left: 50%;
    top: 33%
}

.card-value-3 .pip:nth-of-type(2) {
    left: 50%;
    top: 50%
}

.card-value-3 .pip:nth-of-type(3) {
    left: 50%;
    top: 66%
}

.card-value-4 .pip:nth-of-type(1) {
    left: 33%;
    top: 33%
}

.card-value-4 .pip:nth-of-type(2) {
    left: 66%;
    top: 33%
}

.card-value-4 .pip:nth-of-type(3) {
    left: 33%;
    top: 66%
}

.card-value-4 .pip:nth-of-type(4) {
    left: 66%;
    top: 66%
}

.card-value-5 .pip:nth-of-type(1) {
    left: 33%;
    top: 33%
}

.card-value-5 .pip:nth-of-type(2) {
    left: 66%;
    top: 33%
}

.card-value-5 .pip:nth-of-type(3) {
    left: 50%;
    top: 50%
}

.card-value-5 .pip:nth-of-type(4) {
    left: 33%;
    top: 66%
}

.card-value-5 .pip:nth-of-type(5) {
    left: 66%;
    top: 66%
}

.card-value-6 .pip:nth-of-type(1) {
    left: 33%;
    top: 33%
}

.card-value-6 .pip:nth-of-type(2) {
    left: 66%;
    top: 33%
}

.card-value-6 .pip:nth-of-type(3) {
    left: 33%;
    top: 50%
}

.card-value-6 .pip:nth-of-type(4) {
    left: 66%;
    top: 50%
}

.card-value-6 .pip:nth-of-type(5) {
    left: 33%;
    top: 66%
}

.card-value-6 .pip:nth-of-type(6) {
    left: 66%;
    top: 66%
}

.card-value-7 .pip:nth-of-type(1) {
    left: 33%;
    top: 33%
}

.card-value-7 .pip:nth-of-type(2) {
    left: 66%;
    top: 33%
}

.card-value-7 .pip:nth-of-type(3) {
    left: 50%;
    top: 41%
}

.card-value-7 .pip:nth-of-type(4) {
    left: 33%;
    top: 50%
}

.card-value-7 .pip:nth-of-type(5) {
    left: 66%;
    top: 50%
}

.card-value-7 .pip:nth-of-type(6) {
    left: 33%;
    top: 66%
}

.card-value-7 .pip:nth-of-type(7) {
    left: 66%;
    top: 66%
}

.card-value-8 .pip:nth-of-type(1) {
    left: 33%;
    top: 33%
}

.card-value-8 .pip:nth-of-type(2) {
    left: 66%;
    top: 33%
}

.card-value-8 .pip:nth-of-type(3) {
    left: 50%;
    top: 41%
}

.card-value-8 .pip:nth-of-type(4) {
    left: 33%;
    top: 50%
}

.card-value-8 .pip:nth-of-type(5) {
    left: 66%;
    top: 50%;
}

.card-value-8 .pip:nth-of-type(6) {
    left: 50%;
    top: 58%;
}

.card-value-8 .pip:nth-of-type(7) {
    left: 33%;
    top: 66%
}

.card-value-8 .pip:nth-of-type(8) {
    left: 66%;
    top: 66%
}

.card-value-9 .pip:nth-of-type(1) {
    left: 33%;
    top: 28%;
}

.card-value-9 .pip:nth-of-type(2) {
    left: 66%;
    top: 28%;
}

.card-value-9 .pip:nth-of-type(3) {
    left: 33%;
    top: 40%;
}

.card-value-9 .pip:nth-of-type(4) {
    left: 66%;
    top: 40%;
}

.card-value-9 .pip:nth-of-type(5) {
    left: 50%;
    top: 50%;
}

.card-value-9 .pip:nth-of-type(6) {
    left: 33%;
    top: 59%;
}

.card-value-9 .pip:nth-of-type(7) {
    left: 66%;
    top: 59%;
}

.card-value-9 .pip:nth-of-type(8) {
    left: 33%;
    top: 71%;
}

.card-value-9 .pip:nth-of-type(9) {
    left: 66%;
    top: 71%;
}

.card-value-10 .pip:nth-of-type(1) {
    left: 33%;
    top: 28%
}

.card-value-10 .pip:nth-of-type(2) {
    left: 66%;
    top: 28%
}

.card-value-10 .pip:nth-of-type(3) {
    left: 50%;
    top: 38%
}

.card-value-10 .pip:nth-of-type(4) {
    left: 33%;
    top: 45%
}

.card-value-10 .pip:nth-of-type(5) {
    left: 66%;
    top: 45%
}

.card-value-10 .pip:nth-of-type(6) {
    left: 33%;
    top: 59%
}

.card-value-10 .pip:nth-of-type(7) {
    left: 66%;
    top: 59%
}

.card-value-10 .pip:nth-of-type(8) {
    left: 50%;
    top: 65%
}

.card-value-10 .pip:nth-of-type(9) {
    left: 33%;
    top: 71%
}

.card-value-10 .pip:nth-of-type(10) {
    left: 66%;
    top: 71%
}

@media (max-width: 28em) {
    .hud-deal {
        display: none
    }
}

.card_dealing {
    animation: deal-in .25s both
}

/* Style-guide's reduced-motion override shortens durations but not delays;
   without this the staggered deal leaves cards invisible for ~.7s */
@media (prefers-reduced-motion: reduce) {
    .card_dealing {
        animation-delay: 0ms !important
    }
}