/* Food-card depth and a calm, untimed matching game. */

/* == [zukan] == */
.card .card__pic { transform-origin: 50% 65%; transition: transform .24s cubic-bezier(.2,.75,.25,1); }
.card.gf-tilting .card__pic { transform: perspective(420px) rotateX(var(--gf-rx, 0deg)) rotateY(var(--gf-ry, 0deg)) translateY(-3px) scale(1.055); }
.card.gf-recorded { animation: gf-record-glow 1.3s ease-out; }
.card.gf-recorded .card__st { animation: gf-stamp-settle .65s cubic-bezier(.2,.8,.2,1); }
@keyframes gf-record-glow {
  0%,100% { outline: 0 solid transparent; outline-offset: 0; }
  20% { outline: 4px solid #e5c05e; outline-offset: 4px; }
  65% { outline: 1px solid rgba(229,192,94,.25); outline-offset: 8px; }
}
@keyframes gf-stamp-settle { 0% { transform: scale(.9) rotate(-3deg); } 55% { transform: scale(1.08) rotate(2deg); } 100% { transform: none; } }
[data-motion="reduced"] .card .card__pic { transition: none; }
[data-motion="reduced"] .card.gf-tilting .card__pic { transform: none; }
[data-motion="reduced"] .card.gf-recorded,
[data-motion="reduced"] .card.gf-recorded .card__st { animation: none; }
@media (prefers-reduced-motion: reduce) {
  .card .card__pic { transition: none !important; }
  .card.gf-recorded,.card.gf-recorded .card__st { animation: none !important; }
  .card.gf-tilting .card__pic { transform: none !important; }
}

/* == [hubs] == */
/* えあわせ たんけん (spec 4.8): a full-screen sheet; the 6 cards fill the screen in 3 x 2, the buttons are in the footer */
.gf-memory button:focus-visible { outline: 3px solid #185e87; outline-offset: 4px; }
.gf-memory { position: relative; display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 560px; min-height: 100%; margin: 0 auto; color: #29483b; word-break: keep-all; line-break: strict; }
.gf-memory [hidden] { display: none !important; }
.gf-memory__top { flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.gf-memory__intro { min-width: 0; }
.gf-memory__lead { margin: 0; font-size: 16px; font-weight: 700; line-height: 1.4; text-wrap: balance; }
.gf-memory__help { margin: 2px 0 0; font-size: 15px; line-height: 1.5; color: #4d677a; }
.gf-memory__score { flex: none; display: flex; flex-direction: column; align-items: flex-end; gap: 4px; padding: 6px 10px; border-radius: 12px; background: #f2f4e9; }
.gf-memory__progress { font-weight: 700; font-size: 15px; }
.gf-memory__dots { display: flex; gap: 8px; }
.gf-memory__dots i { display: block; width: 14px; height: 14px; border: 1.5px solid #9cb69b; border-radius: 50%; background: #fff; transition: background .25s, transform .25s; }
.gf-memory__dots i.is-found { background: #e9b747; border-color: #a77d24; transform: scale(1.12); }
/* the board takes the rest of the screen; two rows of three */
.gf-memory__board { flex: 1 1 auto; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); grid-template-rows: repeat(2, minmax(120px, 1fr)); gap: 10px; max-height: 470px; padding: 3px; }
.gf-memory__card { display: block; position: relative; width: 100%; height: 100%; min-height: 120px; padding: 0; border: 0; border-radius: 15px; background: transparent; perspective: 700px; color: inherit; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.gf-memory__turn { display: block; position: absolute; inset: 0; transform-style: preserve-3d; transition: transform .34s cubic-bezier(.18,.72,.25,1); }
.gf-memory__back, .gf-memory__face { display: flex; position: absolute; inset: 0; flex-direction: column; align-items: center; justify-content: center; border: 2px solid #fff; border-radius: 15px; -webkit-backface-visibility: hidden; backface-visibility: hidden; box-shadow: 0 5px 0 #adc3a6, 0 7px 10px #2f523a12; }
.gf-memory__back { gap: 10px; background: radial-gradient(circle at 50% 42%,#558a6b 0,#3f775a 65%,#2f654b 100%); color: #fffcef; outline: 1px solid #bed1ad; }
.gf-memory__back::before { content: ''; position: absolute; inset: 8px; border: 1px solid #e8f0d24f; border-radius: 10px; }
.gf-memory__back-mark { display: grid; place-items: center; width: 48px; height: 48px; border: 1px solid #d6e6b69e; border-radius: 50%; transform: rotate(-14deg); background: #8da47838; }
.gf-memory__back-mark .c-icon { width: 28px; height: 28px; }
.gf-memory__back-word { font-size: 14px; font-weight: 700; letter-spacing: .04em; }
.gf-memory__face { padding: 10px 4px 8px; background: radial-gradient(circle at 50% 38%,#fff 15%,#fffbec 68%); transform: rotateY(180deg); border-color: #dfce92; box-shadow: 0 5px 0 #d1bd77, 0 7px 10px #2f523a12; }
.gf-memory__face img { flex: 1 1 0; min-height: 0; width: 85%; height: 75px; max-height: 64%; object-fit: contain; filter: drop-shadow(0 5px 2px #3c42261a); }
.gf-memory__food-name { margin-top: 4px; font-size: 14px; line-height: 1.3; font-weight: 700; text-align: center; }
.gf-memory__food-name.is-long { font-size: 13px; }
.gf-memory__food-name rt { font-size: 9px; }
.gf-memory__yomi { font-size: 12px; }
.gf-memory__card.is-up .gf-memory__turn { transform: rotateY(180deg); }
.gf-memory__match-mark { display: none; position: absolute; top: 5px; right: 5px; width: 24px; height: 24px; line-height: 24px; border-radius: 50%; color: #fff; background: #347b55; font-size: 14px; font-weight: 700; text-align: center; }
.gf-memory__card.is-matched .gf-memory__match-mark { display: block; }
.gf-memory__card.is-matched .gf-memory__face { border-color: #6b9d62; background: radial-gradient(circle at 50% 30%,#fff 12%,#eef5dd 90%); box-shadow: 0 5px 0 #8faa73, 0 7px 10px #2f523a12; }
.gf-memory__card:not(.is-up):active .gf-memory__turn { transform: scale(.95); }
.gf-memory__status { flex: none; min-height: 3em; margin: 0; font-size: 15px; font-weight: 700; line-height: 1.5; text-align: center; text-wrap: balance; }
/* after the clear: the reward card and the status line under it sit together in the middle of the screen */
.gf-memory.is-reward .gf-memory__top { display: none; }
.gf-memory.is-reward .gf-memory__status { margin-bottom: auto; }
/* each button is at least as wide as its label (never min-width: 0); a row that cannot hold both wraps */
.gf-memory__foot { display: flex; flex-wrap: wrap; gap: 8px; }
.gf-memory__foot > .c-btn { flex: 1 1 auto; width: auto; min-height: 52px; padding: 0 12px; }
.gf-memory__reward { flex: none; margin-top: auto; padding: 16px; border: 1px solid #dec981; border-radius: 20px; background: linear-gradient(120deg,#fff9dd,#fffdf4); animation: gf-reward-in .45s ease-out; }
.gf-memory__reward-head { display: flex; align-items: center; justify-content: center; gap: 14px; }
.gf-memory__medal { display: grid; flex: 0 0 52px; place-items: center; width: 52px; height: 52px; border: 3px double #ad7d2e; border-radius: 50%; background: linear-gradient(135deg,#ffec9d,#e9b849); color: #805724; box-shadow: 0 4px 0 #c79c40; font-size: 30px; transform: rotate(-10deg); }
.gf-memory__reward-title { margin: 0 0 4px; font-family: var(--font-display); font-size: 21px; }
.gf-memory__reward-copy { margin: 0; font-size: 15px; font-weight: 700; }
.gf-memory__learn { margin: 16px 0 8px; font-size: 15px; line-height: 1.6; text-align: center; }
.gf-memory__links { display: flex; flex-direction: column; gap: 8px; }
.gf-memory__food { display: flex; align-items: center; gap: 10px; padding: 4px 12px; min-height: 52px; width: 100%; border: 1px solid #dddfc5; border-radius: 11px; background: #fffdf6; color: #2d664a; font-size: 15px; font-weight: 700; text-align: left; }
.gf-memory__food img { width: 42px; height: 42px; object-fit: contain; }
.gf-memory__food-n { min-width: 0; line-height: 1.35; }
.gf-memory__food-go { margin-left: auto; font-size: 23px; }
@keyframes gf-reward-in { from { opacity: 0; transform: translateY(8px) scale(.98); } to { opacity: 1; transform: none; } }
@media (max-width: 359px) {
.gf-memory__board { gap: 8px; }
.gf-memory__help { display: none; }
.gf-memory__foot > .c-btn { padding: 0 8px; }
}
/* phone landscape: the six cards lie in one row as upright 3 : 4 cards (the food pictures stay big); the status
   line and the pair count sit above them */
@media (orientation: landscape) and (max-height: 499px) {
.gf-memory { display: grid; grid-template-columns: minmax(0, 1fr) auto; grid-template-rows: auto 1fr; grid-template-areas: "status top" "board board"; gap: 6px 12px; max-width: none; }
.gf-memory__top { grid-area: top; }
.gf-memory__intro { display: none; }
.gf-memory__status { grid-area: status; align-self: center; min-height: 0; text-align: left; }
.gf-memory__board, .gf-memory__reward { grid-area: board; }
.gf-memory__board { align-self: center; grid-template-columns: repeat(6, minmax(0, 1fr)); grid-template-rows: none; max-height: none; }
.gf-memory__card { height: auto; min-height: 0; }
.gf-memory__card::before { content: ""; display: block; padding-top: 133%; }
.gf-memory__face { padding: 8px 4px 6px; }
.gf-memory__face img { max-height: 62%; }
.gf-memory__back-word { letter-spacing: 0; }
.gf-memory__score { flex-direction: row; align-items: center; padding: 4px 10px; }
.gf-memory.is-complete .gf-memory__status { margin-bottom: 0; }
.gf-memory__reward { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr); grid-template-areas: "head links" "learn links"; align-items: center; gap: 4px 16px; margin: 0; padding: 12px 16px; }
.gf-memory__reward-head { grid-area: head; gap: 8px; }
.gf-memory__medal { flex-basis: 40px; width: 40px; height: 40px; font-size: 24px; }
.gf-memory__reward .gf-memory__reward-title { font-size: 18px; }
.gf-memory__learn { grid-area: learn; margin: 0; }
.gf-memory__links { grid-area: links; gap: 6px; }
.gf-memory__food { min-height: 48px; }
}
/* Matching beats remain cosmetic and never delay the next card. */
.gf-memory__effects { position:absolute; inset:0; overflow:hidden; z-index:5; border-radius:16px; pointer-events:none; contain:paint; }
.gf-memory__burst { position:absolute; width:1px; height:1px; }
.gf-memory__burst::before { content:''; position:absolute; left:-30px; top:-30px; width:60px; height:60px; border:3px solid #ffcc36; border-radius:50%; animation:gf-match-ring 520ms ease-out both; }
.gf-memory__burst i { position:absolute; left:-4px; top:-4px; width:9px; height:9px; border:1px solid #fff; border-radius:2px; background:#ffcb37; animation:gf-match-spark 620ms cubic-bezier(.15,.65,.25,1) both; }
.gf-memory__burst i:nth-child(3n) { background:#24a9d8; }
.gf-memory__burst i:nth-child(3n + 1) { background:#59b777; border-radius:50%; }
.gf-memory__pair-line { position:absolute; height:5px; border-radius:10px; background:#ffd851; box-shadow:0 0 0 2px #fff9; transform-origin:left center; animation:gf-connect 480ms ease-out both; }
[data-motion="full"] .gf-memory__dealt { animation:gf-deal 300ms cubic-bezier(.18,.75,.25,1) var(--gf-delay,0ms) both; }
[data-motion="full"] .gf-memory__card.is-match-hit .gf-memory__face img { animation:gf-found 420ms cubic-bezier(.18,.75,.25,1) 140ms both; }
[data-motion="full"] .gf-memory__reward .gf-memory__medal { animation:gf-medal-arrive 600ms cubic-bezier(.18,.75,.25,1) both; }
@media(hover:hover) and (pointer:fine) {
  .gf-memory__card:not(.is-up):hover .gf-memory__turn { transform:translateY(-3px) rotateY(-6deg); }
}
@keyframes gf-deal { from { transform:translateY(15px) rotate(-3deg) scale(.95); opacity:.3; } to { transform:translateY(0) rotate(0) scale(1); opacity:1; } }
@keyframes gf-found { 0%,100% { transform:scale(1); } 45% { transform:scale(1.12) translateY(-3px); } }
@keyframes gf-medal-arrive { 0% { transform:scale(.55) rotate(-45deg); } 65% { transform:scale(1.12) rotate(-5deg); } 100% { transform:scale(1) rotate(-10deg); } }
@keyframes gf-match-ring { from { transform:scale(.3); opacity:1; } to { transform:scale(1.6); opacity:0; } }
@keyframes gf-match-spark { 0% { transform:translate(0,0) scale(.5); opacity:0; } 15% { opacity:1; } 100% { transform:translate(var(--x),var(--y)) rotate(var(--r)) scale(.3); opacity:0; } }
@keyframes gf-connect { 0% { transform:rotate(var(--angle)) scaleX(0); opacity:0; } 35% { transform:rotate(var(--angle)) scaleX(1); opacity:1; } 100% { transform:rotate(var(--angle)) scaleX(1); opacity:0; } }
html.quality-paused .gf-memory *, html.quality-paused .gf-memory *::before { animation-play-state:paused!important; }
[data-motion="reduced"] .gf-memory *, [data-motion="reduced"] .gf-memory *::before { animation:none!important; transition:none!important; }
[data-motion="reduced"] .gf-memory__effects { display:none!important; }
[data-motion="reduced"] .gf-memory__card:not(.is-up):hover .gf-memory__turn { transform:none; }
@media(prefers-reduced-motion:reduce) {.gf-memory *, .gf-memory *::before { animation:none!important; transition:none!important; }.gf-memory__effects { display:none!important; }.gf-memory__card:not(.is-up):hover .gf-memory__turn { transform:none; }}
