/* 과일 합치기 게임 전용 CSS (2026-11-13). 무대(머리 줄 + 계기 칸 + 상자)·곁 칸(순위표·과일 순서·내 기록) fmg-*. 공용 부품은 assets/v2.css
   넓으면 무대 | 곁 칸 두 열, 좁으면 한 열. 무대 안은 계기 칸(왼쪽) | 상자(캔버스), 520px 아래에서는 계기 줄 → 상자 → 아이템 줄.
   강조색(accent)은 위험 표시·연속 배수·새 최고 기록처럼 잠깐 나오는 상태에만 쓴다. */
.fmg{container:fmgw / inline-size}
.fmg-grid{display:grid;grid-template-columns:minmax(0,1fr)}
.fmg-stage{position:relative;display:flex;flex-direction:column;gap:10px;min-width:0;padding:14px 16px 14px}
.fmg-bar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:8px 12px}
.fmg-btns{display:flex;flex-wrap:wrap;gap:6px}
.fmg-btns .v2-btn{height:30px} /* 모드 단추(30px)·순위표 기간 단추와 같은 높이로 맞춘다(R41) */
.fmg-got{margin:0;padding:8px 10px;border:1px dashed var(--line);border-radius:var(--radius);background:var(--paper);font-family:var(--sans);font-size:13px;line-height:1.5;color:var(--ink)}
.fmg-got[hidden],.fmg-cover[hidden],.fmg-rankfoot .v2-btn[hidden]{display:none} /* display 를 준 클래스가 hidden 속성을 덮지 않게 */

/* 판: 계기 칸 | 상자 */
.fmg-play{display:grid;grid-template-columns:118px minmax(0,1fr);gap:12px;align-items:start}
.fmg-hud{display:flex;flex-direction:column;gap:7px;min-width:0}
.fmg-stat,.fmg-slot,.fmg-en{display:flex;flex-direction:column;gap:2px;min-width:0;padding:7px 9px;border:1px solid var(--soft);border-radius:var(--radius);background:var(--paper)}
.fmg-stat .v2-label,.fmg-slot .v2-label,.fmg-en .v2-label{margin:0}
.fmg-stat b{font-family:var(--sans);font-size:19px;font-weight:800;line-height:1.2;color:var(--ink);font-variant-numeric:tabular-nums;white-space:nowrap;transform-origin:left center}
.fmg-stat--score b{font-size:25px}
.fmg-stat b.is-bump{animation:fmg-bump .22s ease-out}
.fmg-stat b.is-low{color:var(--accent)}
@keyframes fmg-bump{0%{transform:scale(1)}40%{transform:scale(1.12)}100%{transform:scale(1)}}
.fmg-slot{position:relative}
.fmg-pv{display:flex;align-items:center;justify-content:center;height:66px}
.fmg-pv img{width:calc(var(--sz, 44) * 1px);height:calc(var(--sz, 44) * 1px)} /* 다음·보관: 과일 한 개를 크게(2026-11-13 사용자 지시) */
.fmg-pv img,.fmg-evo img,.fmg-list img,.fmg-facts img{display:block;flex:0 0 auto;user-select:none;-webkit-user-drag:none}
.fmg-hold{appearance:none;font:inherit;color:inherit;text-align:left;cursor:pointer;transition:border-color var(--ease),opacity var(--ease)}
.fmg-hold:hover:not(:disabled){border-color:var(--ink)}
.fmg-hold:disabled{cursor:default;opacity:.55}
.fmg-hold.is-used .fmg-pv{opacity:.5}
.fmg-key{display:inline-block;padding:0 4px;border:1px solid var(--soft);border-radius:2px;font-family:var(--mono);font-size:10.5px;font-weight:600;line-height:15px;color:var(--muted);background:var(--paper)}
.fmg-hold .fmg-key{position:absolute;right:7px;top:7px}
.fmg-en{gap:6px}
.fmg-gauge{display:block;height:8px;border:1px solid var(--line);border-radius:4px;background:var(--card);overflow:hidden}
.fmg-gauge i{display:block;width:0;height:100%;background:var(--ink);transition:width .25s ease}
.fmg-pips{display:flex;gap:5px}
.fmg-pips i{width:10px;height:10px;border:1px solid var(--line);border-radius:50%;background:var(--card)}
.fmg-pips i.is-on{background:var(--ink);border-color:var(--ink)}
.fmg-item{justify-content:space-between;width:100%;height:36px}
.fmg-item:not(:disabled){background:var(--fill);border-color:var(--fill);color:var(--on-fill)}
.fmg-item:not(:disabled):hover{background:var(--fill-hover);border-color:var(--fill-hover)}

/* 상자(캔버스)와 덮개 */
.fmg-field{position:relative;justify-self:center;width:100%;max-width:400px}
.fmg-cv{display:block;width:100%;height:auto;aspect-ratio:360/500;border:1px solid var(--line);border-radius:var(--radius);background:var(--card);touch-action:pan-y;cursor:pointer;-webkit-tap-highlight-color:transparent;user-select:none}
.fmg-cv:focus-visible{outline:2px solid var(--ink);outline-offset:2px}
.fmg-stage[data-ph="play"] .fmg-cv{touch-action:none} /* 판이 진행 중일 때는 누른 채 비스듬히 움직여도 브라우저가 스크롤로 가져가지 않게 한다(시작 전·끝난 뒤에는 세로로 쓸어 넘길 수 있다) */
.fmg-hint{position:absolute;left:12px;right:12px;top:34%;margin:0;padding:8px 10px;border-radius:var(--radius);background:color-mix(in srgb, var(--paper) 88%, transparent);font-family:var(--sans);font-size:13.5px;font-weight:600;line-height:1.5;text-align:center;color:var(--ink);pointer-events:none}
.fmg-stage:not([data-ph="ready"]) .fmg-hint{display:none}
.fmg-cover{position:absolute;inset:0;display:flex;flex-direction:column;align-items:center;justify-content:center;gap:9px;padding:14px;border-radius:var(--radius);background:color-mix(in srgb, var(--paper) 95%, transparent);text-align:center;overflow:auto}
.fmg-ctitle{margin:0;font-family:var(--serif);font-size:17px;font-weight:800;line-height:1.35;color:var(--ink)}
.fmg-final{display:flex;flex-direction:column;align-items:center;gap:2px;margin:0}
.fmg-final b{font-family:var(--sans);font-size:40px;font-weight:800;line-height:1.1;color:var(--ink);font-variant-numeric:tabular-nums}
.fmg-final span{min-height:17px;font-family:var(--sans);font-size:12px;font-weight:700;color:var(--accent)}
.fmg-facts{width:100%;max-width:290px;margin:0;padding:0;list-style:none}
.fmg-facts li{display:flex;align-items:center;justify-content:space-between;gap:10px;min-height:27px;border-bottom:1px solid var(--soft);font-family:var(--sans);font-size:12.5px;color:var(--muted)}
.fmg-facts b{display:inline-flex;align-items:center;gap:5px;font-weight:700;color:var(--ink);font-variant-numeric:tabular-nums;text-align:right}
.fmg-rankline{min-height:20px;margin:2px 0 0;font-family:var(--sans);font-size:13.5px;font-weight:700;line-height:1.45;color:var(--ink)}
.fmg-rankline.is-error{font-weight:600;color:var(--muted)}
.fmg-endbtns{display:flex;flex-wrap:wrap;justify-content:center;gap:6px}
/* 확인 팝업: 진행 중인 판을 버리기 전에 한 번 묻는다 */
.fmg-dlg{width:min(340px, calc(100vw - 32px));margin:auto;padding:18px 18px 14px;border:1px solid var(--line);border-radius:var(--radius);background:var(--card);color:var(--ink);font-family:var(--sans)}
.fmg-dlg::backdrop{background:rgba(26,18,8,.5)}
.fmg-dlgmsg{margin:0 0 14px;font-size:14.5px;font-weight:600;line-height:1.6}
.fmg-dlgbtns{display:flex;flex-wrap:wrap;justify-content:flex-end;gap:6px}
.fmg-dlgbtns .v2-btn{height:36px}
.fmg-help{margin:0;font-family:var(--sans);font-size:12px;line-height:1.55;color:var(--muted)}
.fmg-live{position:absolute;width:1px;height:1px;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap}

/* 곁 칸: 순위표·과일 순서·내 기록 */
.fmg-side{display:flex;flex-direction:column;min-width:0;border-top:1px solid var(--soft)}
.fmg-box{display:flex;flex-direction:column;gap:8px;min-width:0;padding:14px 16px}
.fmg-box + .fmg-box{border-top:1px solid var(--soft)}
.fmg-bhead{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:6px 10px;margin:0}
.fmg-bhead .v2-label{margin:0}
.fmg-rankmode{margin:0;font-family:var(--serif);font-size:15px;font-weight:800;color:var(--ink)}
.fmg-list{display:flex;flex-direction:column;margin:0;padding:0;list-style:none}
.fmg-list li{display:flex;align-items:center;gap:8px;height:31px;border-bottom:1px solid var(--soft);font-family:var(--sans);font-size:13px;color:var(--ink)}
.fmg-list li.is-me{background:var(--accent-wash);box-shadow:-6px 0 0 var(--accent-wash),6px 0 0 var(--accent-wash)}
.fmg-rk{flex:0 0 22px;font-family:var(--mono);font-size:12px;font-weight:700;text-align:right;color:var(--muted)}
.fmg-list li:nth-child(-n+3) .fmg-rk{color:var(--ink)}
.fmg-nm{flex:1 1 auto;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;color:var(--muted)}
.fmg-you{flex:0 0 auto;padding:0 6px;border:1px solid var(--line);border-radius:9px;font-size:11px;font-weight:700;line-height:17px;color:var(--ink);background:var(--paper);white-space:nowrap}
.fmg-list b{flex:0 0 auto;font-weight:750;font-variant-numeric:tabular-nums}
.fmg-del{flex:0 0 auto;width:22px;height:22px;padding:0;border:1px solid var(--soft);border-radius:var(--radius);background:var(--paper);font-size:13px;line-height:1;color:var(--muted);cursor:pointer}
.fmg-note{margin:0;font-family:var(--sans);font-size:12px;line-height:1.55;color:var(--muted)}
.fmg-note:empty,.fmg-rankfoot:not(:has(.v2-btn:not([hidden]))){display:none}
.fmg-rankfoot{display:flex;gap:6px;margin:0}
.fmg-rankfoot .v2-btn,.fmg-clr{height:28px;padding:0 10px;font-size:12px}
.fmg-evo{display:flex;flex-wrap:wrap;align-items:center;gap:6px 4px;margin:0;padding:0;list-style:none}
.fmg-evo li{display:flex;align-items:center;gap:4px}
.fmg-evo li + li::before{content:"›";font-family:var(--sans);font-size:13px;color:var(--line)}
.fmg-evo li:not(.is-on) img{filter:grayscale(1);opacity:.38}
.fmg-evo img{transition:opacity .3s ease,filter .3s ease}
.fmg-tbl{width:100%;border-collapse:collapse;font-family:var(--sans);font-size:12.5px;color:var(--ink)}
.fmg-tbl th,.fmg-tbl td{padding:6px 4px;border-bottom:1px solid var(--soft);font-weight:500;text-align:left;vertical-align:bottom;line-height:1.35} /* 긴 언어의 머리글·과일 이름은 낱말 사이에서 줄을 바꾼다(360px 넘침 방지) */
.fmg-tbl tr:first-child th{font-size:11.5px;font-weight:600;color:var(--muted)}
.fmg-tbl .n{text-align:right;font-variant-numeric:tabular-nums}
.fmg-tbl td.n{font-weight:700}

/* 넓은 작업면: 무대 | 곁 칸 */
@container fmgw (min-width:780px){
  .fmg-grid{grid-template-columns:minmax(0,1fr) 288px}
  .fmg-side{border-top:0;border-left:1px solid var(--soft)}
  .fmg-list{min-height:310px} /* 순위표를 받는 동안 아래 칸이 밀리지 않게 10줄 자리를 잡아 둔다 */
}
/* 좁은 작업면: 계기 줄(점수·최고·시간 / 다음·보관) → 상자 → 아이템 줄(에너지·흔들기·조커) */
@container fmgw (max-width:519px){
  .fmg-stage{padding:12px 12px 12px}
  .fmg-play{grid-template-columns:repeat(6,minmax(0,1fr));gap:7px}
  .fmg-hud{display:contents}
  .fmg-stat{grid-column:span 2;padding:6px 8px}
  .fmg-stat b,.fmg-stat--score b{font-size:18px}
  .fmg-slot{grid-column:span 3;flex-direction:row;align-items:center;gap:8px;padding:4px 8px}
  .fmg-slot .v2-label{flex:0 0 auto}
  .fmg-pv{flex:1 1 auto;height:46px}
  .fmg-pv img{width:calc(var(--sz, 44) * .72px);height:calc(var(--sz, 44) * .72px)}
  .fmg-hold .fmg-key{display:none}
  .fmg-field{grid-column:1 / -1;order:1}
  .fmg-en,.fmg-item{grid-column:span 2;order:2}
  .fmg-en{justify-content:center;padding:5px 8px;gap:4px}
  .fmg-en .v2-label{display:none}
  .fmg-item{height:40px;justify-content:center}
  .fmg-final b{font-size:34px}
}
@media (hover:none){ .fmg-key,.fmg-help{display:none} }

/* 전체 화면(R46): 무대만 남기고 상자를 화면 높이에 맞춘다 */
.fmg-stage:fullscreen,.fmg-stage.is-full{justify-content:flex-start;gap:12px;padding:16px 20px;background:var(--paper);overflow:auto}
.fmg-stage.is-full{position:fixed;inset:0;z-index:99990}
html.fmg-lock{overflow:hidden}
.fmg-stage:fullscreen .fmg-play,.fmg-stage.is-full .fmg-play{width:100%;max-width:calc((100dvh - 150px) * .72 + 132px);margin:0 auto}
.fmg-stage:fullscreen .fmg-field,.fmg-stage.is-full .fmg-field{max-width:calc((100dvh - 150px) * .72)}
.fmg-stage:fullscreen .fmg-cv,.fmg-stage.is-full .fmg-cv{touch-action:none}
.fmg-stage:fullscreen .fmg-bar,.fmg-stage.is-full .fmg-bar,.fmg-stage:fullscreen .fmg-help,.fmg-stage.is-full .fmg-help{width:100%;max-width:calc((100dvh - 150px) * .72 + 132px);margin:0 auto}
@container fmgw (max-width:519px){
  .fmg-stage:fullscreen,.fmg-stage.is-full{padding:12px}
  .fmg-stage:fullscreen .fmg-play,.fmg-stage.is-full .fmg-play,.fmg-stage:fullscreen .fmg-field,.fmg-stage.is-full .fmg-field{max-width:calc((100dvh - 300px) * .72)}
  .fmg-stage:fullscreen .fmg-bar,.fmg-stage.is-full .fmg-bar{max-width:none}
}
@media (prefers-reduced-motion:reduce){ .fmg-stat b.is-bump{animation:none} .fmg-gauge i,.fmg-evo img{transition:none} }
