.ap-game {
  width: min(100%, 410px);
  margin-inline: auto;
  color: var(--font-color, #44364e);
}
.ap-game .ap-tools, .ap-game .ap-score {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem 1rem;
}
.ap-game .ap-tools { justify-content: space-between; margin-bottom: .65rem; }
.ap-game .ap-score { font-size: .86rem; }
.ap-game .ap-score b { margin-left: .15em; font-variant-numeric: tabular-nums; }
.ap-game .ap-shuffle, .ap-game .ap-share, .ap-game .ap-postcard {
  color: #593c62;
  background: #fae9ee;
  border: 1px solid #ddbecb;
  padding: .28rem .8rem;
  min-height: 36px;
  border-radius: 99px;
  font: inherit;
  font-size: .84rem;
  cursor: pointer;
}
.ap-game .ap-board {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(4px, 1.1vw, 9px);
  padding: clamp(5px, 1.1vw, 10px);
  border-radius: 16px;
  background: #e1cfdc;
  background: linear-gradient(155deg, #eedce2, #c9bfd6);
}
.ap-game .ap-card {
  position: relative;
  display: block;
  width: 100%;
  aspect-ratio: 1 / 1.08;
  min-width: 0;
  padding: 0;
  border: none;
  border-radius: 9px;
  background: transparent;
  cursor: pointer;
  font: inherit;
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
}
.ap-game .ap-back, .ap-game .ap-face {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  overflow: hidden;
  border-radius: inherit;
  transition: opacity .17s ease, transform .18s ease;
  pointer-events: none;
}
.ap-game .ap-back {
  color: #f2d7ca;
  background: repeating-linear-gradient(45deg, transparent 0 7px, #f3cfeb0b 7px 8px),
              repeating-linear-gradient(-45deg, transparent 0 7px, #f3cfeb0b 7px 8px),
              linear-gradient(145deg, #6e517e, #423453);
  box-shadow: inset 0 0 0 1px #4a3855;
}
.ap-game .ap-back::before {
  content: '';
  position: absolute;
  inset: 5px;
  border: 1px solid #e7c0c07d;
  border-radius: 5px;
}
.ap-game .ap-back svg { display: block; width: 48%; }
.ap-game .ap-face {
  color: var(--ap-ink);
  background: linear-gradient(155deg, #fffaf0, #fae9e5);
  box-shadow: inset 0 0 0 1px #c9aeb1;
  opacity: 0;
  transform: scaleX(.8);
}
.ap-game .ap-face svg { display: block; width: 52%; max-height: 58%; }
.ap-game .ap-face > span { font-weight: 650; font-size: clamp(.68rem, 2.6vw, .84rem); line-height: 1.4; }
.ap-game .ap-card:not([data-state="back"]) { cursor: default; }
.ap-game .ap-card:not([data-state="back"]) .ap-back { opacity: 0; transform: scaleX(.8); }
.ap-game .ap-card:not([data-state="back"]) .ap-face { opacity: 1; transform: none; }
.ap-game .ap-card[data-state="match"] .ap-face { background: #f3e9e9; }
.ap-game .ap-card[data-state="match"]::after {
  content: '✓';
  position: absolute;
  top: 3px; right: 4px;
  color: #326458;
  font-size: .8rem;
  line-height: 1;
  font-weight: bold;
}
.ap-game button:focus-visible { outline: 3px solid #b65380; outline-offset: 2px; z-index: 1; }
.ap-game .ap-status { margin-top: .55rem; font-weight: 600; font-size: .9rem; }
.ap-game .ap-help { margin-top: .15rem; font-size: .8rem; }
.ap-game .ap-daily-line {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: .2rem 1rem;
  align-items: baseline;
  margin-bottom: .65rem;
  padding-bottom: .45rem;
  border-bottom: 1px dashed #b495ad;
  font-size: .85rem;
  font-variant-numeric: tabular-nums;
}
.ap-game .ap-daily-line time { font-weight: 650; }
.ap-game .ap-daily-foot {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem .65rem;
  align-items: center;
  justify-content: space-between;
  margin-top: .6rem;
  font-size: .8rem;
}
.ap-game .ap-actions { display: flex; flex-wrap: wrap; gap: .45rem; }
.ap-game .ap-postcard { color: #fff8f2; border-color: #66475f; background: #66475f; }
.ap-game .ap-postcard:disabled { cursor: progress; opacity: .7; }
.ap-game .ap-print { width: 100%; margin-top: .35rem; }
.ap-game .ap-print > img {
  display: block;
  max-width: 100%;
  height: auto;
  border-radius: .4rem;
  -webkit-touch-callout: default;
  user-select: auto;
}
.ap-game .ap-print > div { display: flex; justify-content: space-between; flex-wrap: wrap; gap: .25rem .7rem; margin-top: .3rem; }
.ap-game .ap-print a { text-decoration: underline; text-underline-offset: .18em; }
.ap-game .ap-share-text {
  box-sizing: border-box;
  width: 100%;
  border: 1px solid #ad91a4;
  border-radius: .5rem;
  padding: .4rem;
  color: var(--font-color, #44364e);
  background: var(--card-bg, #fffaf7);
}
.ap-game [hidden] { display: none !important; }
@media (hover: hover) {
  .ap-game .ap-card[data-state="back"]:hover .ap-back { filter: brightness(1.13); }
  .ap-game .ap-shuffle:hover { background: #f7dce6; }
}
@media (prefers-reduced-motion: reduce) {
  .ap-game .ap-back, .ap-game .ap-face { transition: none; }
}
