* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
[hidden] { display: none !important; }
#game { position: relative; width: 100vw; height: 100vh; height: 100dvh; overflow: clip; isolation: isolate; touch-action: none; background: #d99464 center / cover no-repeat; }
#game::before { content: ''; position: absolute; inset: 0; background: #68301730; pointer-events: none; }
#stage { position: absolute; inset: 0; padding: env(safe-area-inset-top, 0px) env(safe-area-inset-right, 0px) 0 0; }
#stage > canvas { position: absolute; inset: 0; width: 100% !important; height: 100% !important; }
#game:not([data-screen='play']) #stage { visibility: hidden; }
canvas { display: block; touch-action: none; }
@font-face { font-family: 'Squishy Huninn'; src: url('./fonts/huninn-game.woff2') format('woff2'); font-weight: 400; font-display: swap; }
@font-face { font-family: 'Squishy Nunito'; src: url('./fonts/nunito-800-game.woff2') format('woff2'); font-weight: 800; font-display: swap; }
#interface {
  position: absolute; transform-origin: top left; pointer-events: none; color: #683017;
  font: 400 24px 'Squishy Huninn', 'PingFang TC', 'Microsoft JhengHei', 'Yu Gothic UI', sans-serif;
  --safe-left: calc(env(safe-area-inset-left, 0px) / var(--core-scale));
  --safe-right: calc(env(safe-area-inset-right, 0px) / var(--core-scale));
  --safe-top: calc(env(safe-area-inset-top, 0px) / var(--core-scale));
  --safe-bottom: calc(env(safe-area-inset-bottom, 0px) / var(--core-scale));
}
html[lang='ja'] #interface { font-family: 'Squishy Huninn', 'Hiragino Maru Gothic ProN', 'Yu Gothic UI', sans-serif; }
#interface :is([data-slot^='order-count-'], [data-slot^='txt-cond-'], [data-slot^='txt-L'], [data-slot='txt-day'], [data-slot='txt-score'], [data-slot='txt-best']) { font-family: 'Squishy Nunito', 'Squishy Huninn', sans-serif; font-weight: 800; font-synthesis: none; }
html[lang='en'] #interface :is([data-slot='txt-result-title'], [data-slot='txt-title']) { font-family: 'Squishy Nunito', 'Squishy Huninn', sans-serif; font-weight: 800; }
.asset-loading { position: absolute; z-index: 500; inset: 0; display: grid; align-content: center; justify-items: center; color: #683017; background: #fdebcbef; font: 400 1.2rem 'Squishy Huninn', sans-serif; }
.asset-loading[data-primary] { background: #fdebcb70; }
.asset-loading[data-primary] p { background: #fdebcb; border-radius: 1rem; padding: .5em 1em; }
.asset-loading button { font: inherit; color: inherit; background: #fb9995; border: 2px solid #9c4e2a; border-radius: 1rem; min-height: 44px; padding: .5em 1em; cursor: pointer; }
#interface [data-layer] { position: absolute; inset: 0; isolation: isolate; pointer-events: none; }
.slot, .hotspot { position: absolute; margin: 0; }
.art { background: center / 100% 100% no-repeat; border: solid transparent 0; }
.label { display: flex; align-items: center; white-space: pre-wrap; overflow-wrap: anywhere; line-height: 1.12; font-size: var(--slot-font-size, 18px); }
.label > span { width: 100%; min-width: 0; }
#interface .label[data-loading-label] { color: #7a6458; }
@media (min-width: 320px) and (min-height: 480px) and (orientation: portrait) and (max-height: 567px) {
  .label { font-size: max(var(--slot-font-size, 18px), var(--min-aux-font)); }
  .label[data-text-role='body'] { font-size: max(var(--slot-font-size, 18px), var(--min-body-font)); }
  .hotspot[data-control] { min-width: var(--min-control); min-height: var(--min-control); }
}
.label[data-slot='txt-result-explain'] { white-space: pre-line; }
.label:is([data-slot='txt-note-preview'], [data-slot^='txt-mat-row-'], [data-slot='txt-mat-card'], [data-slot='txt-mat-mix']) { white-space: pre-line; }
.label[data-slot='txt-note-preview'] > span { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
[data-layer='S-CAL-L'] .label[data-slot='txt-note-preview'] > span { -webkit-line-clamp: 5; }
[data-edge] { translate: var(--edge-x, 0px) var(--edge-y, 0px); }
[data-edge~='left'] { --edge-x: calc(var(--safe-left) - var(--extension-x)); }
[data-edge~='right'] { --edge-x: calc(var(--extension-x) - var(--safe-right)); }
[data-edge~='top'] { --edge-y: calc(var(--safe-top) - var(--extension-y)); }
[data-edge~='bottom'] { --edge-y: calc(var(--extension-y) - var(--safe-bottom)); }
.art[data-slot='hud-shelf'] {
  left: calc(-1 * var(--extension-x)) !important;
  top: calc(-1 * var(--extension-y)) !important;
  width: calc(100% + 2 * var(--extension-x)) !important;
  height: calc(var(--slot-height) + var(--safe-top)) !important;
}
.title-dust i { position: absolute; background: var(--spark) center / contain no-repeat; animation: title-spark 5200ms linear infinite; }
@keyframes title-spark { 0%, 100% { opacity: 0; } 15%, 85% { opacity: .4; } 25% { translate: 4px; } 75% { translate: -4px; } 100% { transform: translateY(-45px); } }
@media (prefers-reduced-motion: reduce) { .title-dust { visibility: hidden; } }
#game[data-paused] .title-dust i { animation-play-state: paused; }
.hotspot { pointer-events: auto; border: 0; padding: 0; background: transparent; color: inherit; cursor: pointer; touch-action: none; border-radius: 18px; -webkit-tap-highlight-color: transparent; outline: none; }
.hotspot:focus-visible::after, .hotspot[data-focus]::after { content: ''; position: absolute; inset: var(--focus-inset, 0); border-radius: 21px; box-shadow: 0 0 0 2px #fef6ec, 0 0 0 5px #683017; pointer-events: none; }
.hotspot[data-slot="rail-hit"]::after { content: none; }
.hotspot[data-unavailable] { cursor: default; }
.hotspot:disabled { cursor: default; }
.art[data-disabled] { opacity: .4; }
.art[data-slot='btn-play'][data-disabled] { opacity: 1; }
.mirrored { scale: -1 1; }
.note-paper, .dismiss-scrim { pointer-events: auto; }
.stage-tint::before { content: ''; position: absolute; inset: 2px; border-radius: 12px; background: var(--stage-tint); mix-blend-mode: multiply; opacity: .65; }
.selected-cell { filter: drop-shadow(0 0 3px #e8a135); animation: selected-cell 1900ms ease-in-out infinite alternate; }
@keyframes selected-cell { to { filter: drop-shadow(0 0 6px #f8bc4f); } }
@media (prefers-reduced-motion: reduce) { .selected-cell { animation: none; } }
.label[data-slot^='txt-mat-row-card-'] > span { display: -webkit-box; overflow: hidden; -webkit-box-orient: vertical; -webkit-line-clamp: 3; }
[data-layer='P-CODEX-CARD-L'] .label[data-slot^='txt-mat-row-card-'] > span { -webkit-line-clamp: 8; }
.placeholder { display: grid; place-items: center; color: #683017; font: bold 16px sans-serif; border: 2px dashed #9c4e2a; background: repeating-linear-gradient(135deg, #fdebcb 0 9px, #f4d2a3 9px 16px); }
.scrim { background: #44210f94; inset: calc(-1 * var(--extension-y)) calc(-1 * var(--extension-x)); }
.detail-scrim { background: rgb(90 53 36 / 45%); pointer-events: auto; }
.tier-silhouette { background: #C9A88F !important; mask: var(--tier-mask) center / contain no-repeat; opacity: .6; }
.label[data-slot='txt-detail-name'] { white-space: pre-line; }
.label[data-slot='txt-missing'] { white-space: normal; line-height: 1.25; }
.label { color: #683017; }
.met { filter: sepia(.55) saturate(1.5); }
.unfound { filter: grayscale(1) opacity(.28); }
.game-notice { position: absolute; z-index: 400; inset: auto 12px 12px; margin: auto; width: max-content; max-width: calc(100% - 24px); padding: .5em .9em; border-radius: 12px; color: #683017; background: #fef6ec; font: bold 1rem system-ui; pointer-events: none; }
#boot { position: absolute; inset: 0; display: grid; align-content: center; justify-items: center; gap: .6rem; padding: 1rem; background: #fdebcb; color: #683017; font: 400 1.2rem 'Squishy Huninn', system-ui; text-align: center; }
#boot p { margin: 0; }
#boot progress { width: min(75%, 24rem); accent-color: #fb9995; }
#boot button { font: inherit; color: inherit; background: #fb9995; border: 2px solid #9c4e2a; border-radius: 1rem; min-height: 44px; padding: .5em 1em; cursor: pointer; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
