.pp-match-standalone {
    margin: 0;
    color: #fff1db;
    background: #241c31;
    font: 1rem/1.5 system-ui, sans-serif;
}

.pp-match {
    width: min(100% - 2rem, 75rem);
    margin: 0 auto;
    padding: 1.5rem 0 2rem;
    text-align: center;
}

.pp-match h1, .pp-match h2 {
    margin: 0;
    font: 400 clamp(2rem, 7vw, 3rem)/1.2 Georgia, serif;
}

.pp-match p { margin: .4rem 0; }
.pp-controls { min-height: 3rem; margin: .8rem 0; }

#pp-start {
    padding: .55rem 1.4rem;
    border: 0;
    border-radius: .5rem;
    background: #dda366;
    color: #241c31;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
}

.pp-board {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: clamp(.3rem, 1.6vw, .75rem);
    width: 100%;
    margin: auto;
}

.pp-match [hidden] { display: none; }

.pp-card {
    position: relative;
    aspect-ratio: 406 / 645;
    padding: 0;
    border: 0;
    border-radius: 10%;
    background: transparent;
    perspective: 650px;
    cursor: pointer;
    transition: transform .3s ease-in, opacity .3s ease-in;
}

.pp-card:focus-visible, #pp-start:focus-visible {
    outline: 2px solid #fff1db;
    outline-offset: 3px;
}

.pp-card-inner, .pp-card-front, .pp-card-back {
    position: absolute;
    inset: 0;
}

.pp-card-inner {
    transform-style: preserve-3d;
    transition: transform .3s ease-in-out;
}

.pp-card-front, .pp-card-back {
    backface-visibility: hidden;
    background: center / 100% 100% no-repeat;
}

.pp-card-front {
    display: grid;
    place-items: center;
    transform: rotateY(180deg);
    background-image: url('/public/img/practically-potion-matching-game/practicallypotion-card-front.png');
}

.pp-card-back {
    background-image: url('/public/img/practically-potion-matching-game/practicallypotion-card-back.png?v=24d70307');
}

.pp-card-front canvas {
    width: 82%;
    height: 84%;
    object-fit: contain;
}

.pp-card.is-flipped .pp-card-inner { transform: rotateY(180deg); }
.pp-card.is-matched { opacity: 0; transform: translateX(125%); pointer-events: none; }
.pp-card.is-removed { visibility: hidden; }
.pp-board { overflow: clip; overflow-clip-margin: 5px; }

@media (prefers-reduced-motion: reduce) {
    .pp-card, .pp-card-inner { transition: none; }
}
.pp-title { display: flex; align-items: center; justify-content: center; gap: 12px; min-height: 62px; }
.pp-title img { width: 42px; height: 58px; object-fit: contain; transform: rotate(-14deg); filter: drop-shadow(2px 3px 2px #0007); }
.pp-title img:last-child { transform: rotate(13deg); }
.pp-controls { display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 4px 24px; min-height: 48px; margin: 6px 0; }
#pp-moves { font: 21px/1.3 'Lounge Marker', cursive; transform-origin: center; min-height: 28px; }
#pp-new { border: 0; border-bottom: 1px dashed #d9dfb8; background: transparent; color: #f2e7cb; padding: 8px; font: 17px/1.3 'Lounge Marker', cursive; cursor: pointer; }
#pp-status { flex-basis: 100%; font: 14px/1.4 'Courier New', monospace; min-height: 20px; }
.pp-stage { position: relative; min-height: 0; overflow: hidden; }
.pp-select { position: absolute; inset: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(0, 1fr)); gap: 12px 34px; align-items: center; justify-items: center; width: min(100%, 600px); margin: auto; }
.pp-size { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 6px; width: 100%; height: 100%; max-height: 230px; padding: 8px; border: 0; color: #e4e8cc; background: transparent; font: 24px/1.3 'Lounge Marker', cursive; cursor: pointer; }
.pp-size-large { grid-column: 1 / -1; width: calc(50% - 17px); }
.pp-size svg { width: min(100%, 135px); flex: 1; min-height: 0; max-height: 170px; fill: none; stroke: currentColor; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; filter: drop-shadow(1px 1px 1px #ced3b333); transform: rotate(-3deg); }
.pp-size-medium svg { transform: rotate(3deg); }.pp-size-large svg { transform: rotate(-1deg); }
.pp-size:hover, .pp-size:focus-visible { color: #d0f5a0; outline: 2px dashed #c2d7a366; outline-offset: -5px; border-radius: 12px; }
.pp-board { position: absolute; left: 50%; top: 50%; translate: -50% -50%; grid-template-columns: repeat(var(--pp-columns, 4), minmax(0, 1fr)); gap: var(--pp-gap, 6px); width: var(--pp-grid-width, 90%); overflow: visible; }
.pp-card { filter: drop-shadow(1px 3px 2px #0006); }
.pp-splash { position: absolute; z-index: 3; inset: 0; display: grid; place-items: center; padding: 12px; pointer-events: none; color: #faf1d6; font: clamp(40px, 8vw, 94px)/1.1 'Lounge Marker', cursive; text-shadow: 2px 3px #1c231d, 0 0 3px #fff8; transform: rotate(-4deg); }
@media (max-width: 700px) { .pp-title { gap: 6px; min-height: 52px; } .pp-title img { width: 28px; height: 44px; } #pp-moves { font-size: 18px; } .pp-controls { gap: 2px 12px; } .pp-select { gap: 8px 16px; } .pp-size-large { width: calc(50% - 8px); } .pp-size { font-size: 22px; } }
.pp-size strong { font-weight: normal; }.pp-size span { font: 12px/1.4 'Courier New', monospace; }
/* Match menu and table-top HUD. */
.pp-title { position: relative; min-height: 110px; padding: 8px 100px; }
.pp-title img { position: absolute; left: 8px; top: 0; width: 86px; height: 106px; }
.pp-title img:last-child { left: auto; right: 8px; }
.pp-controls { display: grid; grid-template-columns: minmax(0, 1fr) auto minmax(0, 1fr); align-items: center; width: var(--pp-grid-width, 90%); max-width: 100%; margin: 0 auto 8px; gap: 6px; min-height: 36px; }
#pp-moves { justify-self: start; white-space: nowrap; font-size: 18px; min-height: 0; }
#pp-status { grid-column: 2; grid-row: 1; margin: 0; min-height: 0; font-size: 16px; }
#pp-new { grid-column: 3; grid-row: 1; justify-self: end; white-space: nowrap; padding: 6px 0; }
.pp-match[data-phase="select"] .pp-controls { display: none; }
.pp-match[data-phase="loading"] .pp-controls { display: flex; justify-content: center; width: 100%; }
.pp-select { width: min(100%, 520px); gap: 6px 8px; }
.pp-size { max-height: 280px; }
.pp-size svg { width: min(100%, 195px); max-height: 220px; }
.pp-size-large { width: calc(50% - 4px); }
@media (max-width: 700px) { .pp-title { min-height: 96px; padding: 6px 58px; } .pp-title img { width: 54px; height: 86px; left: 0; } .pp-title img:last-child { right: 0; } #pp-moves, #pp-new { font-size: clamp(12px, 3.5vw, 16px); } #pp-status { font-size: 14px; } .pp-select { gap: 5px 8px; } .pp-size svg { max-height: 200px; } }
.pp-title { grid-row: 1; }.pp-controls { grid-row: 2; }.pp-stage { grid-row: 3; }
#pp-new { font-family: 'Gloria Hallelujah', cursive; font-size: 15px; }
@media (max-width: 700px) { #pp-new { font-size: 12px; } }

.pp-select { width: min(100%, 540px); height: min(100%, 480px); gap: 0 4px; }
@media (max-width: 700px) { .pp-select { height: min(100%, 340px); } }
