/* 그룹 화면(썸네일+게임명) · 게임 팝업(영상+정보) */
:root { --ease: cubic-bezier(.2, .7, .2, 1); }
body.modal-open { overflow: hidden; }
/* ========== GROUP PAGE ========== */
.group-head { padding-top: 30px; padding-bottom: 30px; }
.group-title { display: flex; justify-content: space-between; align-items: end; gap: 24px; border-bottom: 1px solid #ffffff2e; padding-bottom: 26px; }
.group-title h1 { font-size: clamp(3rem, 7vw, 5.5rem); line-height: 1; font-weight: 800; letter-spacing: -.05em; margin: 10px 0 0; }
.group-title p { margin: 0; font-size: 1rem; color: #e4e6ec; }
.tile-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 40px 24px; padding-bottom: 56px; }
.tile { all: unset; cursor: pointer; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.tile:focus-visible { outline: 3px solid #b6c3ff; outline-offset: 6px; border-radius: 14px; }
.tile-art { position: relative; display: block; aspect-ratio: 16/9; border-radius: 14px; overflow: hidden; background: #111217; border: 1px solid #ffffff26;
  transform: translateZ(0); transition: transform .35s var(--ease), border-color .2s; }
/* 그림자·어둡게는 미리 그려둔 층의 투명도만 바꿈 (매 프레임 다시 그리지 않도록) */
.tile-art::after { content: ""; position: absolute; inset: 0; background: rgba(0,0,0,.22); opacity: 0; transition: opacity .3s; pointer-events: none; }
.tile { position: relative; isolation: isolate; }
.tile::before { content: ""; position: absolute; left: 0; top: 0; width: 100%; aspect-ratio: 16/9; border-radius: 14px; box-shadow: 0 22px 40px rgba(0,0,0,.55);
  opacity: 0; transition: opacity .35s var(--ease); pointer-events: none; z-index: -1; }
.tile-art img { width: 100%; height: 100%; object-fit: cover; transition: transform .6s var(--ease); }
.tile-play { position: absolute; left: 50%; top: 50%; width: 56px; height: 56px; margin: -28px 0 0 -28px; border-radius: 50%; background: #fff; color: #0c0d10;
  display: grid; place-items: center; padding-left: 3px; font-size: 18px; opacity: 0; transform: scale(.8); transition: opacity .25s, transform .3s var(--ease); box-shadow: 0 8px 26px rgba(0,0,0,.5); }
.tile-no { position: absolute; left: 12px; top: 12px; font-size: .75rem; font-weight: 800; padding: 5px 9px; border-radius: 6px; background: rgba(8,9,12,.8); color: #fff; }
.tile-name { font-size: 1.1875rem; font-weight: 700; line-height: 1.4; letter-spacing: -.02em; color: #fff; }
@media (hover: hover) {
  .tile:hover .tile-art { transform: translateY(-6px); border-color: #ffffff70; }
  .tile:hover::before { opacity: 1; }
  .tile:hover .tile-art::after { opacity: 1; }
  .tile:hover .tile-art img { transform: scale(1.06); }
  .tile:hover .tile-play { opacity: 1; transform: scale(1); }
}
.tile:focus-visible .tile-play { opacity: 1; transform: scale(1); }
.group-bottom { display: flex; justify-content: space-between; gap: 16px; padding: 10px 0 56px; border-top: 1px solid #ffffff2e; padding-top: 28px; }
.button { border-color: #ffffff80; }

/* 등장 애니메이션 */
.will-in { opacity: 0; transform: translateY(26px); }
.will-in.is-in { opacity: 1; transform: none; transition: opacity .7s var(--ease) var(--d, 0ms), transform .7s var(--ease) var(--d, 0ms); }

/* ========== GAME DIALOG ========== */
#game-dialog { width: calc(100% - 48px); max-width: 1280px; max-height: calc(100svh - 48px); padding: 0; border: 1px solid #ffffff33; border-radius: 20px;
  background: #15161b; color: var(--ink); overflow: hidden; display: none; flex-direction: column; box-shadow: 0 20px 60px rgba(0,0,0,.6); }
#game-dialog[open] { display: flex; animation: pop .35s var(--ease); }
#game-dialog::backdrop { background: rgba(4,5,8,.9); backdrop-filter: none; animation: none; }
@keyframes pop { from { opacity: 0; transform: translateY(18px) scale(.98); } to { opacity: 1; transform: none; } }
.gd-header { display: flex; align-items: center; justify-content: space-between; gap: 16px; padding: 16px 22px; border-bottom: 1px solid #ffffff1f; }
.gd-no { margin: 0 0 2px; font-size: .75rem; font-weight: 800; letter-spacing: .1em; color: #c6c9d2; line-height: 1.4; }
.gd-header h2 { margin: 0; font-size: clamp(1.25rem, 2.2vw, 1.75rem); font-weight: 800; letter-spacing: -.03em; line-height: 1.25; }
.gd-close { flex-shrink: 0; width: 46px; height: 46px; border-radius: 50%; border: 1px solid #ffffff55; background: transparent; color: #fff; font-size: 28px; line-height: 1; }
.gd-close:hover { background: #ffffff1a; border-color: #fff; }
.gd-body { display: grid; grid-template-columns: minmax(0, 1.8fr) minmax(300px, 1fr); min-height: 0; flex: 1; overflow: hidden; }
.gd-media { background: #000; display: flex; flex-direction: column; min-width: 0; }
.gd-frame { aspect-ratio: 16/9; width: 100%; background: #000; position: relative; }
.gd-frame iframe { width: 100%; height: 100%; border: 0; display: block; }
.gd-noimg img { width: 100%; height: 100%; object-fit: contain; opacity: .6; }
.gd-noimg span { position: absolute; inset: auto 0 16px; text-align: center; font-weight: 700; }
.gd-media-bar { display: flex; justify-content: space-between; align-items: center; gap: 12px; padding: 12px 16px; background: #0c0d10; flex-wrap: wrap; }
.gd-tabs { display: flex; gap: 8px; flex-wrap: wrap; }
.gd-tab { border: 1px solid #ffffff55; background: transparent; color: #fff; border-radius: 999px; padding: 7px 14px; font-size: .8125rem; font-weight: 700; }
.gd-tab[aria-pressed="true"] { background: #fff; color: #0c0d10; border-color: #fff; }
.gd-yt { font-size: .8125rem; font-weight: 700; color: #e4e6ec; text-decoration: underline; text-underline-offset: 4px; }
.gd-info { padding: 22px 24px; overflow-y: auto; overscroll-behavior: contain; }
.gd-alias { margin: 0 0 14px; font-size: .9375rem; color: #e4e6ec; }
.gd-meta { margin: 0 0 18px; display: grid; gap: 10px; }
.gd-meta div { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 12px; font-size: .9375rem; line-height: 1.6; }
.gd-meta dt { color: #c6c9d2; font-weight: 600; }
.gd-meta dd { margin: 0; color: #fff; font-weight: 600; }
.gd-desc { font-size: 1rem; line-height: 1.8; color: #eceef2; margin: 0 0 14px; padding-top: 16px; border-top: 1px solid #ffffff1f; }
.gd-link a { color: #b6c3ff; font-weight: 700; text-decoration: underline; text-underline-offset: 4px; }
.gd-note { font-size: .8125rem; color: #c6c9d2; margin: 0 0 20px; }
.gd-advice { padding: 18px; border-radius: 14px; background: #1d1f26; border: 1px solid #ffffff1f; }
.gd-advice h3 { margin: 0 0 10px; font-size: 1rem; }
.gd-form { width: 100%; }
.form-pending { display: flex; gap: 10px; align-items: baseline; margin: 0; font-size: .875rem; color: #d8dbe2; line-height: 1.6; }
.form-pending .dot { width: 8px; height: 8px; border-radius: 50%; background: #e0b354; flex-shrink: 0; transform: translateY(-1px); }
.gd-nav { display: flex; justify-content: space-between; gap: 12px; padding: 12px 16px; border-top: 1px solid #ffffff1f; }
.gd-step { display: inline-flex; align-items: center; gap: 8px; max-width: 48%; border: 1px solid #ffffff40; background: transparent; color: #fff; border-radius: 999px; padding: 9px 16px; font-size: .875rem; font-weight: 600; }
.gd-step b { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; }
.gd-step span:not([aria-hidden]) { color: #c6c9d2; }
.gd-step:hover { background: #ffffff14; border-color: #fff; }

/* ========== 반응형 ========== */
@media (max-width: 1100px) { .tile-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 900px) {
  .gd-body { grid-template-columns: 1fr; overflow-y: auto; }
  .gd-info { overflow: visible; }
}
@media (max-width: 600px) {
  .tile-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 26px 14px; }
  .tile-name { font-size: 1rem; }
  .tile-play { width: 44px; height: 44px; margin: -22px 0 0 -22px; opacity: .92; transform: none; }
  .group-title { display: block; }
  .group-title p { margin-top: 14px; }
  #game-dialog { width: 100%; max-width: none; max-height: 100svh; height: 100svh; border-radius: 0; border: 0; }
  .gd-header { padding: 12px 14px; }
  .gd-info { padding: 18px 16px 24px; }
  .gd-step { padding: 9px 14px; font-size: .8125rem; white-space: nowrap; }
  .gd-step span:not([aria-hidden]) { display: none; }
  .group-bottom { flex-direction: column; }
}
.reduce-motion .will-in { opacity: 1; transform: none; }
.reduce-motion #game-dialog[open] { animation: none; }
/* 첫 화면 목록의 버튼형 썸네일·제목 */
button.ov-thumb { padding: 0; cursor: pointer; width: 100%; color: inherit; font: inherit; }
.ov-title { all: unset; cursor: pointer; }
.ov-title:focus-visible { outline: 3px solid #b6c3ff; outline-offset: 4px; border-radius: 4px; }

/* 영상 재생 중 성능: 팝업 뒤 화면의 애니메이션·전환을 멈춰 영상에 자원을 몰아줌 */
body.modal-open main, body.modal-open main *, body.modal-open .site-header, body.modal-open .site-header * {
  animation-play-state: paused !important; transition: none !important; }
#game-dialog { contain: layout paint; }
.gd-frame { contain: strict; aspect-ratio: 16/9; }

/* ========== 성능 보강 ========== */
/* 화면 전환: 전체 화면 스냅샷(View Transition) 대신 가벼운 페이드 */
main { view-transition-name: none !important; }
main.route-fade { animation: route-fade .28s ease; }
@keyframes route-fade { from { opacity: 0; } to { opacity: 1; } }
/* 팝업 영상 자리: iframe이 붙기 전까지 썸네일을 보여줌 */
.gd-poster, .gd-poster img { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; }
.gd-poster { opacity: .55; }
.gd-frame { position: relative; background: #000; }
/* 등장이 끝난 타일은 레이어 힌트 해제 */
.will-in.is-in { will-change: auto; }
@media (prefers-reduced-motion: reduce) { main.route-fade { animation: none; } }

/* ========== 세로 포스터(1600×2000, 4:5) 타일 ========== */
.tile-grid { gap: 44px 22px; }
.tile-art, .tile::before { aspect-ratio: 4 / 5; }
.tile-art img { position: absolute; inset: 0; }
.tile:hover .tile-art img.tile-poster, .tile:hover .tile-art img:not(.tile-bg) { will-change: transform; }
/* 포스터가 없는 게임: 흐린 배경 + 가운데 가로 이미지 */
.tile-art.is-fallback img.tile-bg { object-fit: cover; transition: none; } /* 흐림·어둡게는 이미지에 미리 입혀 둠 */
.tile-art.is-fallback img:not(.tile-bg) { top: 50%; bottom: auto; height: auto; aspect-ratio: 16 / 9; transform: translateY(-50%); box-shadow: 0 10px 30px rgba(0,0,0,.5); }
@media (hover: hover) { .tile:hover .tile-art.is-fallback img:not(.tile-bg) { transform: translateY(-50%) scale(1.04); } }
.tile-soon { position: absolute; left: 50%; bottom: 14px; transform: translateX(-50%); font-size: .75rem; font-weight: 700; color: #ffffffb0; white-space: nowrap; letter-spacing: .02em; }
/* 게임명: 가운데 정렬 */
.tile { align-items: stretch; }
.tile-name { text-align: center; word-break: keep-all; }
