/* fit.css: phone play mode (all games, tools/frame.js loads it). See _shared/fit.js.
 * html.gf-play = on a phone the game's stage covers the whole screen (inside the safe area);
 * html.gf-port / html.gf-land = how the phone is held. Nothing here applies on a PC. */

/* ---- share row (rule A21), same look as game-kit share-bar ---- */
.gf-sharebar { display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 6px 8px; margin: 10px auto 0; max-width: 100%; pointer-events: auto; position: relative; z-index: 5; }
.gf-sharebar .gf-sb-btn { box-sizing: border-box; display: inline-flex; align-items: center; justify-content: center; gap: 6px; min-height: 44px; min-width: 44px; padding: 0 12px; border-radius: 10px;
  border: 1px solid rgba(160,160,180,.5); background: rgba(20,22,34,.82); color: #eee; font: 600 14px/1.2 "Zen Kaku Gothic New", "Noto Sans JP", sans-serif; text-decoration: none; cursor: pointer; white-space: nowrap; touch-action: manipulation; letter-spacing: 0; }
.gf-sharebar .gf-sb-btn:hover { filter: brightness(1.15); }
.gf-sharebar .gf-sb-btn:focus-visible { outline: 2px solid #4fd6c8; outline-offset: 2px; }
.gf-sharebar .gf-sb-x { background: #000; color: #fff; border-color: #555; }
.gf-sharebar .gf-sb-more { color: #ffb23f; border-color: #b8761a; }
.gf-sharebar svg { width: 16px; height: 16px; flex: none; }
.gf-sharebar .gf-sb-note { flex-basis: 100%; font-size: 14px; color: #c9c2ad; text-align: center; }
.gf-sharebar .gf-sb-note:empty { display: none; }
.gf-sharebar.gf-sb-compact { gap: 6px; margin-top: 6px; }
.gf-sharebar.gf-sb-compact .gf-sb-btn { padding: 0 10px; font-size: 14px; }
.gf-share-below { margin: 14px auto 0; }

/* ---- the "play on the whole screen" pill (phone, page view) ---- */
.gf-fit-go { position: fixed; right: calc(12px + env(safe-area-inset-right)); bottom: calc(12px + env(safe-area-inset-bottom)); z-index: 2147482000;
  min-height: 48px; padding: 0 18px; border-radius: 999px; border: 2px solid #ffb23f; background: #0d1321; color: #ffb23f;
  font: 700 15px/1 "Zen Kaku Gothic New", "Noto Sans JP", sans-serif; box-shadow: 0 6px 18px rgba(0,0,0,.45); cursor: pointer; touch-action: manipulation; }
html.gf-play .gf-fit-go { display: none; }

/* ---- play mode ---- */
html.gf-play, html.gf-play body { overflow: hidden !important; overscroll-behavior: none; }
html.gf-play [data-gf-stage] {
  position: fixed !important; top: 0 !important; left: 0 !important; right: 0 !important; bottom: 0 !important;
  width: auto !important; max-width: none !important; height: auto !important; max-height: none !important; min-height: 0 !important;
  margin: 0 !important; border-radius: 0 !important; z-index: 2147481000 !important; box-sizing: border-box !important;
  overflow-x: hidden !important; overflow-y: auto !important; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
  touch-action: manipulation;
  padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left) !important;
  background-color: var(--gf-stage-bg, #0a0c18);
}
html.gf-play.gf-port [data-gf-stage] { padding-top: calc(46px + env(safe-area-inset-top)) !important; }
html.gf-play.gf-land [data-gf-stage] { padding-right: calc(58px + env(safe-area-inset-right)) !important; }
html.gf-play [data-gf-stage] canvas[data-gf-canvas] { max-width: none !important; max-height: none !important; margin-left: auto !important; margin-right: auto !important; display: block; }
/* the arcade console (.gc): no frame shadow, the HUD wraps less */
html.gf-play [data-gf-stage].gc { box-shadow: none !important; border: 0 !important; }
html.gf-play [data-gf-stage] .gc-screen { display: flex; flex-direction: column; justify-content: center; }
/* landscape, side layout: the board on the left, HUD and buttons in a column on the right */
html.gf-play.gf-side [data-gf-stage] { display: block !important; }
html.gf-play.gf-side [data-gf-stage] > [data-gf-col] { position: fixed !important; left: env(safe-area-inset-left); top: env(safe-area-inset-top); bottom: env(safe-area-inset-bottom); right: auto !important;
  width: var(--gf-cw) !important; height: auto !important; max-width: none !important; margin: 0 !important; float: none !important; display: flex !important; flex-direction: column !important; align-items: center; justify-content: center; z-index: 1; }
html.gf-play.gf-side [data-gf-stage] > :not([data-gf-col]) { margin-left: calc(var(--gf-cw) + 6px) !important; width: auto !important; max-width: none !important; }
html.gf-play.gf-side [data-gf-stage] .gc-tools { grid-template-columns: repeat(3, 1fr); }
/* side layout: the start / result cover spreads over the whole screen (the board column alone is too narrow for its text) */
html.gf-play.gf-side [data-gf-col] .gc-over { position: fixed !important; left: 0 !important; top: 0 !important; bottom: 0 !important; right: calc(58px + env(safe-area-inset-right)) !important; z-index: 40 !important; }
/* play mode, round 2: the read-outs (.gc-hud) become one thin line — label and value side by side,
   no cards, scrolls sideways if it ever runs long. Values stay 16px, labels 14px (A12). */
html.gf-play [data-gf-stage] :is(.gc-hud, .gf-hudline) { display: flex !important; flex-wrap: nowrap !important; grid-template-columns: none !important; align-items: baseline !important;
  gap: 0 .9rem !important; padding: .2rem .6rem !important; overflow-x: auto; overflow-y: hidden; scrollbar-width: none; min-height: 0 !important; }
html.gf-play [data-gf-stage] :is(.gc-hud, .gf-hudline)::-webkit-scrollbar { display: none; }
html.gf-play [data-gf-stage] :is(.gc-hud, .gf-hudline) > * { flex: 0 0 auto !important; width: auto !important; min-width: 0 !important; min-height: 0 !important; height: auto !important;
  margin: 0 !important; padding: 0 !important; border: 0 !important; background: none !important; box-shadow: none !important; text-align: left !important; }
html.gf-play [data-gf-stage] :is(.gc-hud, .gf-hudline) > * > *:not([hidden]):not(.gf-keep-block) { display: inline-block; margin: 0 .3em 0 0 !important; padding: 0 !important; }
/* a HUD wrapped in one inner box (snake: .snake-hud grid of cards): flatten one level deeper */
html.gf-play [data-gf-stage] :is(.gc-hud, .gf-hudline) > *:only-child { display: flex !important; flex-wrap: nowrap !important; grid-template-columns: none !important; align-items: baseline !important; gap: 0 .9rem !important; }
html.gf-play [data-gf-stage] :is(.gc-hud, .gf-hudline) > *:only-child > * { flex: 0 0 auto !important; width: auto !important; min-width: 0 !important; min-height: 0 !important; height: auto !important;
  margin: 0 !important; padding: 0 !important; border: 0 !important; background: none !important; box-shadow: none !important; text-align: left !important; }
html.gf-play [data-gf-stage] :is(.gc-hud, .gf-hudline) > *:only-child > *[hidden] { display: none !important; }
html.gf-play [data-gf-stage] :is(.gc-hud, .gf-hudline) > *:only-child > * > *:not([hidden]) { display: inline-block; margin: 0 .3em 0 0 !important; padding: 0 !important; }
html.gf-play [data-gf-stage] :is(.gc-hud, .gf-hudline), html.gf-play [data-gf-stage] :is(.gc-hud, .gf-hudline) * { font-size: 14px !important; line-height: 1.35 !important; letter-spacing: 0 !important; }
html.gf-play [data-gf-stage] :is(.gc-hud, .gf-hudline) b, html.gf-play [data-gf-stage] :is(.gc-hud, .gf-hudline) strong { font-size: 16px !important; min-width: 0 !important; }
/* while playing (no start / result cover on screen): how-to text, legends and mode pickers fold away;
   they come back on the start and result screens */
html.gf-live [data-gf-stage] .gc-dock p,
html.gf-live [data-gf-stage] .gc-dock [class*="mode" i]:not(button),
html.gf-live [data-gf-stage] .gc-dock [class*="help" i], html.gf-live [data-gf-stage] .gc-dock [class*="howto" i],
html.gf-live [data-gf-stage] .gc-dock [class*="desc" i], html.gf-live [data-gf-stage] .gc-dock [class*="explain" i],
html.gf-live [data-gf-stage] .gc-dock [class*="legend" i], html.gf-live [data-gf-stage] .gc-dock [class*="rule" i],
html.gf-live [data-gf-stage] .gc-dock [class*="caption" i], html.gf-live [data-gf-stage] .gc-dock [class*="lead" i],
html.gf-live [data-gf-stage] > p, html.gf-live [data-gf-stage] > [class*="help" i] { display: none !important; }
/* per-game explanations (fit-config fold) fold away while playing; the 「？ 説明」 button in the play bar opens them */
html.gf-live:not(.gf-help) [data-gf-stage] .gf-fold { display: none !important; }
html.gf-help .gf-playui [data-pu="help"] { color: #ffb23f; border-color: #b8761a; }
html.gf-land .gf-playui .gf-pu-hl { font-size: 12px; }
/* the landscape rail: two short lines instead of a broken word */
html.gf-land .gf-playui .gf-pu-more .gf-l { display: block; text-align: center; line-height: 1.2; }

/* page mode (games that are already a full app page): only the site frame above it is folded away */
html.gf-page .gf-bar, html.gf-page .gf-crumb { display: none !important; }

/* play bar (portrait: a band on top / landscape: a rail on the right) */
.gf-playui { position: fixed; z-index: 2147482500; display: none; gap: 6px; align-items: center; box-sizing: border-box;
  background: rgba(10,15,26,.94); font: 700 14px/1 "Zen Kaku Gothic New", "Noto Sans JP", sans-serif; color: #ece3cb; }
html.gf-play .gf-playui { display: flex; }
html.gf-port .gf-playui { left: 0; right: 0; top: 0; height: calc(46px + env(safe-area-inset-top)); padding: env(safe-area-inset-top) calc(4px + env(safe-area-inset-right)) 0 calc(4px + env(safe-area-inset-left)); border-bottom: 1px solid #2b3b5e; }
html.gf-land .gf-playui { top: 0; bottom: 0; right: 0; width: calc(58px + env(safe-area-inset-right)); flex-direction: column; justify-content: flex-start; padding: calc(4px + env(safe-area-inset-top)) env(safe-area-inset-right) env(safe-area-inset-bottom) 0; border-left: 1px solid #2b3b5e; }
.gf-playui button, .gf-playui a { box-sizing: border-box; min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; gap: 4px; padding: 0 8px;
  border: 1px solid #2b3b5e; border-radius: 8px; background: #131b2d; color: #ece3cb; font: inherit; text-decoration: none; cursor: pointer; touch-action: manipulation; }
.gf-playui .gf-pu-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: #ffb23f; font-size: 15px; padding: 0 4px; }
html.gf-land .gf-playui .gf-pu-title { display: none; }
html.gf-land .gf-playui button, html.gf-land .gf-playui a { width: 52px; padding: 0; font-size: 12px; flex-direction: column; gap: 2px; min-height: 52px; }
.gf-playui svg { width: 20px; height: 20px; flex: none; }
.gf-playui .gf-pu-more { color: #ffb23f; border-color: #b8761a; }

/* share sheet */
.gf-sheet { position: fixed; inset: 0; z-index: 2147483000; display: flex; align-items: center; justify-content: center; background: rgba(5,8,14,.72); padding: 16px; }
.gf-sheet[hidden] { display: none; }
.gf-sheet > div { background: #131b2d; border: 1px solid #2b3b5e; border-radius: 12px; padding: 16px; max-width: 420px; width: 100%; color: #ece3cb; font: 16px/1.6 "Zen Kaku Gothic New", "Noto Sans JP", sans-serif; text-align: center; }
.gf-sheet h2 { margin: 0 0 6px; font-size: 17px; }
.gf-sheet .gf-sheet-close { margin-top: 12px; min-height: 44px; min-width: 120px; border-radius: 8px; border: 1px solid #2b3b5e; background: #0d1321; color: #ece3cb; font: inherit; cursor: pointer; }

/* first-time one-line hint (fit.js hint()) */
.gf-hint { position: fixed; left: 50%; top: calc(56px + env(safe-area-inset-top)); transform: translateX(-50%); z-index: 2147482800; max-width: min(92vw, 520px);
  padding: 10px 16px; border-radius: 10px; background: rgba(13,19,33,.95); border: 1px solid #ffb23f; color: #ece3cb; font: 700 16px/1.5 "Zen Kaku Gothic New", "Noto Sans JP", sans-serif;
  box-shadow: 0 8px 22px rgba(0,0,0,.5); pointer-events: none; text-align: center; transition: opacity .4s; }
.gf-hint.out { opacity: 0; }
@media (prefers-reduced-motion: reduce) { .gf-hint { transition: none; } }
