#lbg-match { box-sizing: border-box; margin: -8px; width: calc(100% + 16px); min-height: 100dvh; background: #121212; color: #fff5e4 !important; font-family: Kanit, Sarabun, system-ui, sans-serif; font-size: 14px; line-height: 1.5; isolation: isolate; }
#lbg-match :where(div,header,footer,section,h1,h2,p,span,strong,button,a,img,progress) { box-sizing: border-box; color: #fff5e4 !important; }
#lbg-match [hidden] { display: none !important; }
#lbg-match .shell { max-width: 390px; min-height: 100dvh; margin: 0 auto; padding: 14px 20px 12px; display: flex; flex-direction: column; }
#lbg-match.assets-ready { background: #121212 url('assets/images/background.webp') center / cover; }
#lbg-match .topline { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 44px; }
#lbg-match .eyebrow { font-size: 12px; letter-spacing: .6px; color: #dac5a5 !important; }
#lbg-match button, #lbg-match a { font: inherit; cursor: pointer; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
#lbg-match button:focus-visible, #lbg-match a:focus-visible { outline: 3px solid #ffd700; outline-offset: 4px; }
#lbg-match .sound { background: #1e1e1e; border: 1px solid #65533f; border-radius: 22px; min-width: 88px; min-height: 44px; padding: 9px 12px; font-size: 12px; }
#lbg-match .screen { flex: 1; }
#lbg-match h1, #lbg-match h2, #lbg-match p { margin: 0; }
#lbg-match h1 { font-size: 30px; font-weight: 800; letter-spacing: -.8px; line-height: 1.35; }
#lbg-match h2 { font-size: 25px; font-weight: 800; }
#lbg-match .cover { text-align: center; padding-top: 13px; display: flex; flex-direction: column; justify-content: center; align-items: center; }
#lbg-match .subtitle { color: #cab8ab !important; margin-top: 6px; font-size: 13px; }
#lbg-match .cover-art { display: block; width: 250px; max-width: 90%; height: 278px; object-fit: contain; margin: 8px auto 4px; border-radius: 20px; }
#lbg-match .goal { display: flex; gap: 10px; justify-content: center; align-items: center; font-size: 12px; background: #281f18; border: 1px solid #5b4221; border-radius: 30px; padding: 9px 12px; }
#lbg-match .gold { color: #ffd700 !important; white-space: nowrap; }
#lbg-match .instructions { max-width: 290px; font-size: 13px; color: #d6c7b8 !important; margin: 13px auto; }
#lbg-match .primary, #lbg-match .secondary, #lbg-match .replay { display: flex; width: 100%; min-height: 48px; justify-content: center; align-items: center; text-decoration: none; padding: 10px 16px; border-radius: 14px; font-weight: 700; }
#lbg-match .primary { background: linear-gradient(125deg,#ff8c00,#ff4500); border: 1px solid #ffa43a; color: #15100a !important; box-shadow: 0 5px 20px #ff6b0024; }
#lbg-match .primary:hover { filter: brightness(1.08); }
#lbg-match .secondary { background: #1e1e1e; border: 1px solid #78716b; color: #f2e8dd !important; }
#lbg-match .micro { color: #c5b6ad !important; font-size: 12px; text-align: center; line-height: 1.6; }
#lbg-match .cover .micro { margin-top: 10px; }
#lbg-match .notice { color: #cdbda9 !important; text-align: center; font-size: 12px; border-top: 1px solid #40372e; margin-top: 14px; padding-top: 10px; }
#lbg-match .loading { display: flex; flex-direction: column; justify-content: center; align-items: center; gap: 20px; text-align: center; }
#lbg-match .loading-gem { color: #ffd700 !important; font-size: 70px; }
#lbg-match progress { width: 85%; height: 12px; border: 0; border-radius: 12px; overflow: hidden; background: #352a3b; accent-color: #ff8c00; }
#lbg-match progress::-webkit-progress-bar { background: #352a3b; }
#lbg-match progress::-webkit-progress-value { background: linear-gradient(90deg,#ff8c00,#ff4500); }
#lbg-match progress::-moz-progress-bar { background: #ff8c00; }
#lbg-match .play { display: flex; flex-direction: column; justify-content: center; }
#lbg-match .play-title { display: flex; justify-content: space-between; align-items: center; margin-top: 12px; }
#lbg-match .play-title h1 { font-size: 23px; }
#lbg-match .play-title .gold { font-size: 16px; }
#lbg-match .stats { display: grid; grid-template-columns: repeat(3,1fr); background: #1e1e1e; border: 1px solid #56413c; border-radius: 16px; margin-top: 12px; padding: 10px 4px; text-align: center; }
#lbg-match .stats div + div { border-left: 1px solid #4c3b40; }
#lbg-match .stats span, #lbg-match .result-stats span { display: block; font-size: 12px; color: #d4bfae !important; }
#lbg-match .stats strong, #lbg-match .result-stats strong { font-size: 24px; font-variant-numeric: tabular-nums; }
#lbg-match .target { display: flex; justify-content: space-between; align-items: center; gap: 6px; padding: 10px 2px 10px; font-size: 12px; }
#lbg-match .target > span:first-child { color: #e2c9a1 !important; }
#lbg-match .board { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: 9px; width: 100%; }
#lbg-match .card { position: relative; aspect-ratio: 1; min-width: 44px; min-height: 44px; background: none; border: 0; padding: 0; border-radius: 13px; perspective: 600px; }
#lbg-match .card-inner { display: block; width: 100%; height: 100%; position: relative; transform-style: preserve-3d; transition: transform .34s cubic-bezier(.2,.75,.3,1); }
#lbg-match .card.open .card-inner { transform: rotateY(180deg); }
#lbg-match .back, #lbg-match .front { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; border-radius: 12px; backface-visibility: hidden; -webkit-backface-visibility: hidden; overflow: hidden; }
#lbg-match .back { background: #211432 var(--card-back) center / 113%; box-shadow: 0 4px 6px #0006; border: 1px solid #d4af37; }
#lbg-match .front { transform: rotateY(180deg); background: #211432; border: 1px solid #b89a57; }
#lbg-match .front img { width: 100%; height: 100%; object-fit: contain; }
#lbg-match .card.matched .front { border-color: #ffd700; box-shadow: 0 0 14px #ffd70035; }
#lbg-match .card.matched::after { content: '✦'; position: absolute; right: -3px; top: -8px; font-size: 24px; color: #ffd700 !important; pointer-events: none; animation: lbg-match-spark .65s ease-out both; }
#lbg-match .card.wrong { animation: lbg-match-shake .25s ease-in-out; }
#lbg-match .feedback { min-height: 47px; padding-top: 14px; text-align: center; font-size: 13px; color: #ffdb97 !important; }
#lbg-match .play > .micro { margin-top: 5px; }
#lbg-match .result { display: flex; flex-direction: column; justify-content: center; text-align: center; gap: 7px; padding: 8px 0; }
#lbg-match .result-stars { color: #ffd700 !important; font-size: 52px; line-height: 1.2; letter-spacing: 6px; filter: drop-shadow(0 4px 16px #ff8c0033); }
#lbg-match .result h2 { margin-bottom: 3px; font-size: 23px; }
#lbg-match .result-stats { display: grid; grid-template-columns: 1fr 1fr; padding: 8px; border: 1px solid #5e4543; border-radius: 16px; background: #1e1e1e; }
#lbg-match .best { color: #e0c696 !important; font-size: 13px; }
#lbg-match .stamp { color: #ffd700 !important; background: #382b13; border: 1px solid #d4af37; border-radius: 30px; align-self: center; padding: 6px 20px; font-weight: 700; }
#lbg-match .result-hint { color: #dbcabf !important; font-size: 12px; }
#lbg-match .replay { border: 1px solid #8b6955; background: #322427; color: #ffe3b0 !important; }
@keyframes lbg-match-spark { from { opacity: 0; transform: scale(.3) rotate(-20deg); } 45% { opacity: 1; } to { opacity: 0; transform: scale(1.8) translateY(-12px); } }
@keyframes lbg-match-shake { 25% { transform: translateX(-2px); } 75% { transform: translateX(2px); } }
@media (max-height: 650px) {
  #lbg-match .cover-art { height: 220px; }
  #lbg-match .shell { padding-top: 8px; }
  #lbg-match .play-title { margin-top: 5px; }
}
@media (prefers-reduced-motion: reduce) {
  #lbg-match .card-inner { transition: none; }
  #lbg-match .card.matched::after, #lbg-match .card.wrong { animation: none; }
}
