/* Floating game controls, without a website masthead or navigation bar. */
.app-header,body[data-view="battle"] .app-header { position:fixed; inset:max(16px,env(safe-area-inset-top)) 24px auto; width:auto; max-width:none; min-height:0; margin:0; padding:0; border:0; display:flex; justify-content:space-between; gap:12px; z-index:30; pointer-events:none; }
.app-header>button { pointer-events:auto; }
.app-header .icon-button { margin-left:auto; background:#fffaf063; border-color:#91b4a380; box-shadow:0 2px 0 #426c5412; }
.app-header .back-button { font-weight:700; color:var(--ink); background:transparent; font-size:12px; border:0; letter-spacing:.08em; }
body:not([data-view="menu"]) #title-return { display:none; }
body[data-view="battle"] .app-header { display:none; }
body[data-view="menu"] { height:100dvh; min-height:0; overflow:hidden; }
body[data-view="menu"] main { height:100%; width:100%; display:flex; align-items:center; }
#menu-view { position:relative; width:100%; height:100%; min-height:0; padding:64px 0; }
.game-screen-title { font-family:Georgia,"Hiragino Mincho ProN",serif; font-weight:500; letter-spacing:.08em; }
.text-letter { display:inline-block; transform-origin:50% 80%; }
.flow-heading,.section-heading { position:relative; }
.flow-heading::after,.section-heading::after { content:''; display:block; width:110px; height:1px; margin:16px auto 0; background:linear-gradient(90deg,transparent,#b99d60,transparent); }
.menu-grid { gap:30px; padding:0 12px; }
.menu-tile { height:clamp(180px,47dvh,410px); padding:18px 18px 28px; border-radius:6px 26px; background:linear-gradient(150deg,#fffff058,#f9f5e6c9); border:1px solid #f8fff0; box-shadow:0 14px 35px #32594712,inset 0 0 0 5px #eef4df55; text-align:center; isolation:isolate; transition:transform .25s,box-shadow .25s,border-color .25s; }
.menu-tile::before { content:''; position:absolute; inset:10px; border:1px solid #a5b89657; border-radius:2px 19px; pointer-events:none; }
.menu-art { height:min(26dvh,245px); margin:0 0 14px; display:grid; filter:drop-shadow(0 10px 8px #31573b18); }
.menu-art img { grid-area:1 / 1; min-height:0; transition:opacity .18s ease-out; pointer-events:none; }
.menu-art-selected { opacity:0; }
.menu-tile:focus-visible .menu-art-idle { opacity:0; }
.menu-tile:focus-visible .menu-art-selected { opacity:1; }
@media(hover:hover) {
  .menu-tile:hover .menu-art-idle { opacity:0; }
  .menu-tile:hover .menu-art-selected { opacity:1; }
}
.menu-art img { animation:menu-character-idle 5s ease-in-out infinite; }
.menu-tile:nth-child(2) img { animation-delay:-1.6s; }.menu-tile:nth-child(3) img { animation-delay:-3.2s; }
.menu-tile h2 { font-size:clamp(17px,2vw,23px); margin:12px 0 0; letter-spacing:.08em; }
.menu-cursor { display:block; margin:14px auto 0; color:var(--gold); font-size:12px; opacity:.3; transition:opacity .2s,transform .2s; }
.menu-tile:hover,.menu-tile:focus-visible { transform:translateY(-7px); border-color:#d6bb78; box-shadow:0 18px 38px #32594725,0 0 0 2px #d6bb783b; }
.menu-tile:hover .menu-cursor,.menu-tile:focus-visible .menu-cursor { opacity:1; transform:scale(1.2); }
.menu-tile:active { transform:translateY(-2px) scale(.98); }
.primary-button,.secondary-button,.quiet-button { transition:transform .18s,box-shadow .18s,background-color .18s; }
.primary-button:hover,.secondary-button:hover { transform:translateY(-2px); box-shadow:0 5px 15px #174f4926; }
.primary-button:active,.secondary-button:active { transform:scale(.97); }
.setup-panel,.lobby-panel { border-radius:6px 24px; background:linear-gradient(145deg,#fffdf2c9,#eff4e6b8); border-color:#fcfff1; box-shadow:0 12px 40px #315b4510; }
#matching-view { padding:76px 0 30px; min-height:100dvh; }
#matching-view .flow-heading { margin-bottom:26px; }
#matching-view .flow-heading h1 { font-size:clamp(26px,4vw,38px); margin:0; }
body[data-view="collection"] main { padding-top:60px; }
.section-heading h1 { font-size:32px; }
.title-footer { border:0; justify-content:flex-end; }
.start-button { border-radius:4px 18px; letter-spacing:.2em; justify-content:center; }
.title-stack { animation:title-cards-idle 7s ease-in-out infinite; }
body[data-view="battle"] main { padding-top:max(8px,env(safe-area-inset-top)); }
.screen-curtain { position:fixed; inset:0; z-index:70; pointer-events:none; background:linear-gradient(115deg,#d7ece2 0%,#f7f3df 58%,#c7e2d3 100%); }
.screen-curtain::before { content:''; position:absolute; inset:-30%; transform:rotate(-16deg); border-top:1px solid #c3ad6c; border-bottom:1px solid #c3ad6c; background:linear-gradient(90deg,transparent,#fffdf260,transparent); }
@keyframes menu-character-idle { 0%,100% { transform:translateY(0) rotate(-1deg); } 50% { transform:translateY(-6px) rotate(1deg); } }
@keyframes title-cards-idle { 0%,100% { translate:0 0; } 50% { translate:0 -8px; } }
@media(max-width:720px) {
  .app-header { inset:max(10px,env(safe-area-inset-top)) 12px auto; padding:0; }
  .app-header .back-button { font-size:10px; }
  #menu-view { padding:64px 0 24px; }
  .menu-grid { gap:12px; padding:0 8px; }
  .menu-tile { height:clamp(90px,17dvh,142px); padding:16px 22px 16px 108px; display:flex; justify-content:center; flex-direction:column; border-radius:4px 20px; }
  .menu-art { top:4px; bottom:4px; left:12px; width:88px; height:auto; margin:0; }
  .menu-tile h2 { margin:0; font-size:18px; }
  .menu-cursor { position:absolute; right:16px; bottom:14px; margin:0; font-size:9px; }
  #matching-view { padding:70px 0 24px; }
  .flow-heading::after,.section-heading::after { margin-top:12px; }
  .resume-button { margin-top:14px; }
}
@media(min-width:721px) and (max-height:500px) {
  #menu-view { padding:50px 0; }
  .menu-tile { height:clamp(170px,49dvh,220px); padding:8px 12px 14px; }
  .menu-art { height:28dvh; margin-bottom:5px; }
  .menu-tile h2 { margin-top:5px; font-size:17px; }
  .menu-cursor { margin-top:6px; font-size:9px; }
}
@media(min-width:721px) {
  #menu-view .resume-button { position:absolute; bottom:12px; left:50%; transform:translateX(-50%); margin:0; }
}
@media(prefers-reduced-motion:reduce) { .menu-art img,.title-stack { animation:none; } .menu-art img,.menu-tile,.menu-cursor,.primary-button,.secondary-button,.quiet-button { transition:none; } }
.reduce-motion .menu-art img,.reduce-motion .title-stack { animation:none; }
.reduce-motion .menu-art img,.reduce-motion .menu-tile,.reduce-motion .menu-cursor,.reduce-motion .primary-button,.reduce-motion .secondary-button,.reduce-motion .quiet-button { transition:none; }
dialog:not(#result-dialog)[open] { animation:game-dialog-enter .3s cubic-bezier(.2,.75,.2,1); border-radius:5px 24px; }
dialog:not(#result-dialog)[open]::backdrop { animation:game-backdrop-enter .25s ease-out; }
@keyframes game-dialog-enter { from { opacity:0; translate:0 18px; scale:.97; } to { opacity:1; translate:0 0; scale:1; } }
@keyframes game-backdrop-enter { from { opacity:0; } to { opacity:1; } }
@media(prefers-reduced-motion:reduce) { dialog:not(#result-dialog)[open],dialog:not(#result-dialog)[open]::backdrop { animation:none; } }
.reduce-motion dialog:not(#result-dialog)[open],.reduce-motion dialog:not(#result-dialog)[open]::backdrop { animation:none; }
