/* Games pop-up tab. Sits in the Leo pop-up, never over the player. Room is kept for the corner mini-player. */
#leo-pop-body:has(.hbn-games-paper) { background: var(--leo-pop-bg); color: var(--leo-pop-fg); padding: 0; overflow: hidden; }
.hbn-games-paper {
  display: flex; flex-direction: column; height: 100%; min-height: 100%;
  padding: 18px 22px 14px; box-sizing: border-box;
  font-family: var(--leo-pop-font); color: var(--leo-pop-fg);
}
.hbn-games-head { flex: 0 0 auto; margin: 0 0 10px; padding: 0 0 10px; border-bottom: 2px solid var(--leo-pop-line); }
.hbn-games-mast { margin: 0; font: 700 13px/1.2 var(--leo-pop-font); letter-spacing: .14em; text-transform: uppercase; }
.hbn-games-bar { display: flex; align-items: center; gap: 12px; margin-top: 8px; min-height: 0; }
.hbn-games-bar:not(:has(.hbn-games-back:not([hidden]))) { display: none; }
.hbn-games-back {
  font: 700 13px/1.2 var(--leo-pop-font); letter-spacing: .06em; text-transform: uppercase;
  margin: 0; padding: 7px 12px; min-height: 36px; border: 2px solid var(--leo-pop-line);
  background: transparent; color: var(--leo-pop-fg); cursor: pointer;
}
.hbn-games-back:hover, .hbn-games-back:focus-visible { background: var(--leo-pop-inset); }
.hbn-games-now { font: 700 15px/1.2 var(--leo-pop-font); letter-spacing: .04em; }

.hbn-games-menu {
  flex: 1 1 auto; min-height: 0; overflow: auto; -webkit-overflow-scrolling: touch;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); grid-auto-rows: min-content; gap: 12px; align-content: start;
}
.hbn-games-menu[hidden], .hbn-games-stage[hidden] { display: none; }
.hbn-games-card {
  display: block; text-align: left; width: 100%; box-sizing: border-box;
  margin: 0; padding: 12px 14px; min-height: 108px; border: 2px solid var(--leo-pop-line);
  background: var(--leo-pop-btn-bg); color: var(--leo-pop-btn-fg); cursor: pointer; font-family: var(--leo-pop-font);
  box-shadow: inset 1px 1px 0 var(--leo-pop-hi), inset -1px -1px 0 var(--leo-pop-lo);
}
.hbn-games-card:hover, .hbn-games-card:focus-visible { background: var(--leo-pop-inset); }
.hbn-games-card > span { display: block; }
.hbn-games-ic { font-size: 26px; line-height: 1; margin-bottom: 4px; }
.hbn-games-name { font-size: 15px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; }
.hbn-games-blurb { font-size: 13px; line-height: 1.35; color: var(--leo-pop-muted); }
.hbn-games-credit { grid-column: 1 / -1; margin: 6px 0 0; font-size: 12px; line-height: 1.5; color: var(--leo-pop-muted); }
.hbn-games-credit a { color: inherit; font-weight: 700; }
.hbn-games-loading { margin: 24px 0; color: var(--leo-pop-muted); }
body.hbn-pip .hbn-games-menu { padding-bottom: 150px; }

.hbn-games-stage { position: relative; flex: 1 1 auto; min-height: 0; }
.g-wrap { position: absolute; inset: 0; display: flex; gap: 16px; overflow: auto; -webkit-overflow-scrolling: touch; }
.g-main { flex: 1 1 0; min-width: 0; min-height: 0; display: flex; align-items: center; justify-content: center; position: relative; }
.g-side { flex: 0 0 188px; display: flex; flex-direction: column; gap: 8px; min-width: 0; align-self: stretch; }
body.hbn-pip .g-side { padding-bottom: 130px; }
.g-stat { margin: 0; font: 700 14px/1.3 var(--leo-pop-font); }
.g-stat b { font-weight: 700; }
.g-note { margin: 0; font-size: 12px; line-height: 1.4; color: var(--leo-pop-muted); }
.g-msg { margin: 0; min-height: 1.4em; font: 700 14px/1.35 var(--leo-pop-font); }
.g-btn {
  font: 700 13px/1.2 var(--leo-pop-font); letter-spacing: .05em; text-transform: uppercase;
  margin: 0; padding: 9px 12px; min-height: 40px; border: 2px solid var(--leo-pop-line);
  background: var(--leo-pop-btn-bg); color: var(--leo-pop-btn-fg); cursor: pointer; touch-action: manipulation;
  box-shadow: inset 1px 1px 0 var(--leo-pop-hi), inset -1px -1px 0 var(--leo-pop-lo);
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.g-btn:hover { filter: brightness(1.05); }
.g-btn.is-on, .g-btn[aria-pressed="true"] { background: var(--leo-pop-bar); color: var(--leo-pop-bar-fg); }
.g-row { display: flex; flex-wrap: wrap; gap: 6px; }
.g-row .g-btn { flex: 1 1 auto; }
.g-select { font: 700 13px/1.2 var(--leo-pop-font); padding: 8px; min-height: 40px; border: 2px solid var(--leo-pop-line); background: var(--leo-pop-btn-bg); color: var(--leo-pop-btn-fg); }
.g-canvas { display: block; background: #0b1638; border: 2px solid var(--leo-pop-line); touch-action: none; -webkit-user-select: none; user-select: none; max-width: 100%; }
.g-pad { display: grid; grid-template-columns: repeat(3, 56px); grid-template-rows: repeat(2, 48px); gap: 6px; justify-content: center; }
.g-pad .g-btn { padding: 0; font-size: 20px; min-height: 0; }
.g-pad .up { grid-column: 2; grid-row: 1; } .g-pad .left { grid-column: 1; grid-row: 2; }
.g-pad .down { grid-column: 2; grid-row: 2; } .g-pad .right { grid-column: 3; grid-row: 2; }

body.hbn-pip:not(.leo-pop-side) #leo-pop-body:has(.hbn-games-paper) { padding-bottom: 0; }

/* Minesweeper */
.ms-board { display: grid; gap: 1px; background: var(--leo-pop-line); border: 2px solid var(--leo-pop-line); -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
.ms-cell { width: var(--cs); height: var(--cs); margin: 0; padding: 0; border: 0; border-radius: 0; background: var(--leo-pop-btn-bg); color: var(--leo-pop-fg); font: 800 calc(var(--cs) * .55)/1 var(--leo-pop-font); cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: inset 2px 2px 0 var(--leo-pop-hi), inset -2px -2px 0 rgba(0,0,0,.3); }
.ms-cell.open { background: var(--leo-pop-inset); box-shadow: none; cursor: default; }
.ms-cell.mine { background: #b91c1c; color: #fff; }
.ms-cell.boom { background: #ef4444; }
.ms-cell.wrong { text-decoration: line-through; }
.ms-n1 { color: #2563eb; } .ms-n2 { color: #15803d; } .ms-n3 { color: #dc2626; } .ms-n4 { color: #6d28d9; }
.ms-n5 { color: #9a3412; } .ms-n6 { color: #0e7490; } .ms-n7 { color: #111; } .ms-n8 { color: #6b7280; }
html[data-theme="night"] .ms-n1 { color: #60a5fa; } html[data-theme="night"] .ms-n2 { color: #4ade80; } html[data-theme="night"] .ms-n3 { color: #f87171; }
html[data-theme="night"] .ms-n4 { color: #c4b5fd; } html[data-theme="night"] .ms-n7 { color: #e5e7eb; }

/* Solitaire */
.sol-table { position: relative; margin: 0 auto; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
.sol-slot { position: absolute; width: var(--cw); height: var(--ch); border: 2px dashed var(--leo-pop-line); opacity: .45; box-sizing: border-box; border-radius: 4px; display: flex; align-items: center; justify-content: center; font-size: calc(var(--cw) * .5); }
.sol-card { position: absolute; width: var(--cw); height: var(--ch); box-sizing: border-box; border-radius: 4px; border: 2px solid #172554; background: #fff; color: #111; font: 700 calc(var(--cw) * .3)/1 var(--leo-pop-font); cursor: pointer; padding: 2px 3px; text-align: left; overflow: hidden; }
.sol-card.red { color: #c81e1e; }
.sol-card.down { background: repeating-linear-gradient(45deg, #172554 0 5px, #1e3a8a 5px 10px); color: transparent; }
.sol-card .big { position: absolute; right: 3px; bottom: 1px; font-size: calc(var(--cw) * .5); }
.sol-card.sel { outline: 3px solid #D4A537; outline-offset: -1px; z-index: 999 !important; }

/* Crossword */
.cw-grid { display: grid; grid-template-columns: repeat(5, var(--cs)); grid-auto-rows: var(--cs); gap: 2px; background: var(--leo-pop-line); border: 2px solid var(--leo-pop-line); -webkit-user-select: none; user-select: none; touch-action: manipulation; }
.cw-cell { position: relative; margin: 0; padding: 0; border: 0; border-radius: 0; background: var(--leo-pop-bg); color: var(--leo-pop-fg); font: 800 calc(var(--cs) * .5)/1 var(--leo-pop-font); display: flex; align-items: center; justify-content: center; cursor: pointer; }
.cw-cell.black { background: var(--leo-pop-line); cursor: default; }
.cw-cell.word { background: #dbeafe; color: #172554; }
.cw-cell.cur { background: #fcd34d; color: #172554; }
.cw-cell.bad { color: #dc2626; }
.cw-cell .num { position: absolute; top: 1px; left: 3px; font: 700 calc(var(--cs) * .2)/1 var(--leo-pop-font); }
.cw-clue { margin: 0 0 8px; padding: 8px 10px; background: var(--leo-pop-inset); border: 1px solid var(--leo-pop-line); font: 700 14px/1.35 var(--leo-pop-font); min-height: 2.8em; }
.cw-list { margin: 0; padding: 0; list-style: none; font-size: 13px; line-height: 1.35; }
.cw-list h4 { margin: 8px 0 3px; font: 700 12px/1 var(--leo-pop-font); letter-spacing: .1em; text-transform: uppercase; }
.cw-list li { padding: 3px 4px; cursor: pointer; }
.cw-list li.on { background: #dbeafe; color: #172554; }
.cw-keys { display: grid; grid-template-columns: repeat(10, 1fr); gap: 4px; margin-top: 8px; width: 100%; }
.cw-keys .g-btn { padding: 0; min-height: 40px; font-size: 14px; letter-spacing: 0; }
@media (max-width: 760px) { .cw-keys .g-btn { min-height: 36px; } .cw-clue { margin-bottom: 6px; padding: 6px 8px; min-height: 0; font-size: 13px; } .cw-keys { margin-top: 6px; } }
.cw-keys .wide { grid-column: span 2; font-size: 12px; }

/* Chess + Checkers */
.bd { display: grid; grid-template-columns: repeat(8, var(--cs)); grid-template-rows: repeat(8, var(--cs)); border: 3px solid var(--leo-pop-line); -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; touch-action: manipulation; }
.bd-sq { position: relative; margin: 0; padding: 0; border: 0; border-radius: 0; display: flex; align-items: center; justify-content: center; cursor: pointer; font-family: "Segoe UI Symbol", "Noto Sans Symbols 2", "DejaVu Sans", Arial, sans-serif; font-size: calc(var(--cs) * .78); line-height: 1; }
.bd-sq.l { background: #e9d8b4; } .bd-sq.d { background: #a9774b; }
.bd-sq.sel { box-shadow: inset 0 0 0 4px #D4A537; }
.bd-sq.last { background-image: linear-gradient(rgba(250, 204, 21, .45), rgba(250, 204, 21, .45)); }
.bd-sq.chk { background-image: radial-gradient(circle, rgba(220, 38, 38, .85), rgba(220, 38, 38, 0) 75%); }
.bd-sq.tgt::after { content: ""; position: absolute; width: 28%; height: 28%; border-radius: 50%; background: rgba(23, 37, 84, .45); }
.bd-sq.tgt.cap::after { width: 86%; height: 86%; background: transparent; border: 4px solid rgba(23, 37, 84, .5); box-sizing: border-box; }
.pc-w { color: #fff; text-shadow: 0 0 2px #000, 0 0 2px #000, 0 1px 1px #000; }
.pc-b { color: #111; text-shadow: 0 0 1px #fff; }
.ck { width: 76%; height: 76%; border-radius: 50%; box-sizing: border-box; display: flex; align-items: center; justify-content: center; font-size: calc(var(--cs) * .4); font-weight: 800; }
.ck.r { background: radial-gradient(circle at 35% 30%, #f87171, #b91c1c); border: 3px solid #7f1d1d; color: #fde68a; }
.ck.k { background: radial-gradient(circle at 35% 30%, #4b5563, #111); border: 3px solid #000; color: #fde68a; }

/* Pinball */
.pb-main { flex-direction: column; gap: 8px; }
.pb-stagebox { position: relative; display: inline-block; line-height: 0; }
.pb-btns { display: flex; justify-content: space-between; gap: 10px; flex: 0 0 auto; }
.pb-btns .g-btn { flex: 1 1 0; min-height: 52px; font-size: 14px; touch-action: none; }
.g-pad2 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.g-pad2 .g-btn { padding: 0; min-height: 44px; font-size: 18px; }
.g-pad2 .span2 { grid-column: span 2; font-size: 13px; }
.pb-launch { flex: 0 0 auto; width: 100%; box-sizing: border-box; min-height: 54px; font-size: 15px; touch-action: none; }

.hbn-games-paper.in-game .hbn-games-mast { display: none; }
.hbn-games-paper.in-game .hbn-games-head { margin-bottom: 8px; padding-bottom: 8px; }
.hbn-games-paper.in-game .hbn-games-bar { margin-top: 0; }

@media (max-width: 760px) {
  .hbn-games-paper { padding: 10px 12px 10px; }
  .hbn-games-menu { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .hbn-games-card { min-height: 96px; padding: 10px; }
  .g-wrap { flex-direction: column; gap: 8px; }
  .g-main { flex: 1 1 0; }
  .g-side { flex: 0 0 auto; align-self: auto; padding-bottom: 0 !important; flex-direction: row; flex-wrap: wrap; align-items: center; }
  .g-side .g-stat { flex: 0 0 auto; margin-right: 10px; }
  .g-side .g-note { display: none; }
  .g-side .g-msg { flex: 1 1 100%; min-height: 0; }
  .g-side .g-select { flex: 1 1 auto; }
  .g-wrap.g-flow { overflow: auto; }
  .g-wrap.g-flow .g-main { flex: 0 0 auto; width: 100%; overflow: visible; }
  .g-wrap.g-rowm { flex-direction: row; gap: 10px; }
  .g-wrap.g-rowm .g-side { flex: 0 0 122px; flex-direction: column; flex-wrap: nowrap; align-items: stretch; align-self: stretch; overflow: hidden; }
  .g-wrap.g-rowm .g-side .g-msg { font-size: 12px; flex: 0 0 auto; }
  .g-wrap.g-rowm .g-pad { grid-template-columns: repeat(3, 1fr); grid-template-rows: repeat(2, 44px); }
  .g-hide-m { display: none !important; }
  .g-wrap.g-rowm .g-side .g-stat { margin-right: 0; font-size: 13px; }
  .g-wrap.g-rowm .g-side .g-btn { padding: 8px 6px; min-height: 40px; font-size: 12px; }
  .pb-launch { flex: 0 0 auto; min-height: 64px; }
  .pb-btns .g-btn { min-height: 54px; }
  body.hbn-pip .hbn-games-paper { padding-bottom: calc(126px + env(safe-area-inset-bottom, 0px)); }
}
/* Go Fish + Old Maid. Additive only; other game styles are unchanged. */
.hd-table {
  display: flex; flex-direction: column; gap: 10px; width: 100%; max-width: 740px;
  margin: 0 auto; padding: 4px 0 8px; box-sizing: border-box;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.hd-label { margin: 0; font: 700 12px/1.2 var(--leo-pop-font); letter-spacing: .08em; text-transform: uppercase; color: var(--leo-pop-muted); text-align: center; }
.hd-row { display: flex; flex-wrap: wrap; gap: 6px; justify-content: center; align-items: flex-end; }
.hd-row.fan { flex-wrap: nowrap; overflow-x: auto; -webkit-overflow-scrolling: touch; justify-content: flex-start; padding: 6px 4px; max-width: 100%; }
.hd-row.fan .hd-card { margin-right: -16px; flex: 0 0 auto; }
.hd-row.fan .hd-card:last-child { margin-right: 0; }
.hd-card {
  position: relative; width: var(--cw, 52px); height: var(--ch, 74px);
  box-sizing: border-box; border-radius: 4px; border: 2px solid #172554;
  background: #fff; color: #111; font: 700 calc(var(--cw, 52px) * .28)/1 var(--leo-pop-font);
  cursor: pointer; padding: 2px 3px; text-align: left; overflow: hidden;
  touch-action: manipulation; -webkit-user-select: none; user-select: none; flex: 0 0 auto;
}
.hd-card.red { color: #c81e1e; }
.hd-card.down { background: repeating-linear-gradient(45deg, #172554 0 5px, #1e3a8a 5px 10px); color: transparent; cursor: pointer; }
.hd-card .big { position: absolute; right: 3px; bottom: 1px; font-size: calc(var(--cw, 52px) * .45); }
.hd-card.sel { outline: 3px solid #D4A537; outline-offset: -1px; }
.hd-card:disabled { cursor: default; }
.hd-stock { display: flex; flex-direction: column; align-items: center; gap: 6px; margin: 4px 0; }
.hd-books { display: flex; flex-wrap: wrap; gap: 4px; justify-content: center; min-height: 1.2em; }
.hd-book { display: inline-flex; align-items: center; justify-content: center; min-width: 28px; padding: 3px 7px; border: 2px solid var(--leo-pop-line); font: 700 13px/1.2 var(--leo-pop-font); background: var(--leo-pop-inset); color: var(--leo-pop-fg); }
.hd-log { margin: 0; padding: 8px 10px; background: var(--leo-pop-inset); border: 1px solid var(--leo-pop-line); font: 700 14px/1.35 var(--leo-pop-font); min-height: 2.6em; text-align: center; }
@media (max-width: 760px) {
  .hd-card { --cw: 46px; --ch: 64px; width: 46px; height: 64px; }
  .hd-row { gap: 5px; }
  .hd-row.fan .hd-card { margin-right: -20px; }
}

.hd-top { display: flex; flex-wrap: wrap; gap: 10px 16px; align-items: flex-end; justify-content: center; }
.hd-cpu { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
@media (max-width: 760px) {
  .hd-table { gap: 6px; padding-bottom: 8px; }
  .hd-log { padding: 6px 8px; min-height: 0; font-size: 13px; }
  .hd-stock { margin: 0; }
  body.hbn-pip .hd-table { padding-bottom: calc(130px + env(safe-area-inset-bottom, 0px)); }
}

/* Playing cards (Solitaire, Go Fish, Old Maid): 5:7, rounded, SVG suits. */
.pcard {
  --cw: 56px;
  --ch: calc(var(--cw) * 1.4);
  position: relative;
  width: var(--cw);
  height: var(--ch);
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: calc(var(--cw) * 0.1);
  background: #fff;
  color: #161616;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, .22), 0 1px 2px rgba(15, 23, 42, .12);
  cursor: pointer;
  overflow: hidden;
  flex: 0 0 auto;
  touch-action: manipulation;
  -webkit-user-select: none; user-select: none;
  -webkit-touch-callout: none;
  font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
.pcard.red { color: #c10d0d; }
.pcard.sel { box-shadow: 0 0 0 3px #D4A537, 0 0 0 1px rgba(15, 23, 42, .22); z-index: 999; }
.pcard:disabled { cursor: default; }
.pcard:focus-visible { outline: 2px solid #D4A537; outline-offset: 2px; }
.pc-corner {
  position: absolute;
  display: flex;
  flex-direction: column;
  align-items: center;
  line-height: 1;
  width: 32%;
  pointer-events: none;
}
.pc-tl { top: 4%; left: 4%; }
.pc-br { right: 4%; bottom: 4%; transform: rotate(180deg); }
.pc-rank { font-weight: 800; font-size: calc(var(--cw) * 0.26); letter-spacing: -0.04em; }
.pcard[data-r="10"] .pc-rank { font-size: calc(var(--cw) * 0.2); letter-spacing: -0.06em; }
.pc-suit svg, .pc-pip svg { display: block; width: 1em; height: 1em; }
.pc-suit { font-size: calc(var(--cw) * 0.2); margin-top: 0.05em; }
.pc-pip {
  position: absolute;
  left: 50%;
  top: 53%;
  transform: translate(-50%, -50%);
  font-size: calc(var(--cw) * 0.42);
  pointer-events: none;
  line-height: 0;
}
.pcard.down {
  color: transparent;
  background-color: #14244c;
  background-image:
    repeating-linear-gradient(135deg, rgba(212, 165, 55, .2) 0 1.5px, transparent 1.5px 7px),
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .05) 0 1.5px, transparent 1.5px 7px);
  box-shadow:
    inset 0 0 0 2px #14244c,
    inset 0 0 0 4px #c9a227,
    0 0 0 1px #0b1638;
}

/* Solitaire slots follow the same size and radius. */
.sol-table { position: relative; margin: 0 auto; -webkit-user-select: none; user-select: none; }
.sol-table .pcard { position: absolute; }
.sol-slot {
  position: absolute;
  width: var(--cw);
  height: var(--ch);
  box-sizing: border-box;
  border-radius: calc(var(--cw) * 0.1);
  border: 2px dashed var(--leo-pop-line);
  opacity: .4;
  display: flex; align-items: center; justify-content: center;
  font-size: calc(var(--cw) * 0.4);
  color: var(--leo-pop-fg);
}

/* Hands: even gaps; fan uses a consistent overlap. */
.hd-row { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; align-items: flex-end; }
.hd-row.fan {
  flex-wrap: nowrap;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  justify-content: flex-start;
  gap: 0;
  padding: 4px 2px;
  max-width: 100%;
}
.hd-row.fan .pcard { margin-left: calc(var(--cw) * -0.36); }
.hd-row.fan .pcard:first-child { margin-left: 0; }

/* Sit the tableau at the top of the pop-up — no tall empty band above the hand. */
.g-wrap.g-flow .g-main { align-items: flex-start; justify-content: flex-start; }
.hd-table { margin-top: 0; }

@media (max-width: 760px) {
  .pcard { --cw: 46px; }
  .hd-row { gap: 6px; }
  .hd-row.fan .pcard { margin-left: calc(var(--cw) * -0.4); }
}
/* ===== HBN games-refresh v1 (style only, owner via Jolie 2026-11-26). Overrides above; no game logic changed. ===== */
/* Menu tiles: flat site style, square icon badge, crisp border, gold focus. */
.hbn-games-menu { grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 12px; padding: 2px 2px 4px; }
.hbn-games-card {
  display: grid; grid-template-columns: 44px minmax(0, 1fr); grid-template-rows: auto 1fr; column-gap: 12px; row-gap: 4px;
  align-items: start; min-height: 92px; padding: 14px; border: 2px solid var(--leo-pop-line); border-radius: 0;
  background: var(--leo-pop-bg); color: var(--leo-pop-fg); box-shadow: none;
  transition: background-color .12s ease, box-shadow .12s ease, transform .12s ease;
}
.hbn-games-card:hover { background: var(--leo-pop-inset); box-shadow: 4px 4px 0 var(--leo-pop-line); transform: translate(-2px, -2px); }
.hbn-games-card:active { transform: none; box-shadow: none; }
.hbn-games-card:focus-visible { outline: 3px solid #D4A537; outline-offset: 2px; }
.hbn-games-card > .hbn-games-ic {
  grid-row: 1 / span 2; display: flex; align-items: center; justify-content: center; width: 44px; height: 44px; margin: 0;
  box-sizing: border-box; border: 2px solid var(--leo-pop-line); background: var(--leo-pop-bar); color: var(--leo-pop-bar-fg);
  font-size: 22px; line-height: 1;
}
.hbn-games-card > .hbn-games-name { align-self: end; font-size: 14px; line-height: 1.2; letter-spacing: .06em; }
.hbn-games-card > .hbn-games-blurb { font-size: 12.5px; line-height: 1.4; }
.hbn-games-head { border-bottom-width: 2px; }
.hbn-games-mast { font-size: 13px; letter-spacing: .16em; }

/* Buttons: one height, flat, pressed state, gold focus. */
.g-btn, .hbn-games-back {
  min-height: 40px; padding: 8px 12px; border: 2px solid var(--leo-pop-line); border-radius: 0;
  background: var(--leo-pop-bg); color: var(--leo-pop-fg); box-shadow: none;
  transition: background-color .1s ease, color .1s ease;
}
.g-btn:hover, .hbn-games-back:hover { filter: none; background: var(--leo-pop-inset); }
.g-btn:active { background: var(--leo-pop-bar); color: var(--leo-pop-bar-fg); }
.g-btn:focus-visible, .hbn-games-back:focus-visible, .g-select:focus-visible { outline: 3px solid #D4A537; outline-offset: 1px; }
.g-btn:disabled { opacity: .45; cursor: default; }
.g-btn.is-on, .g-btn[aria-pressed="true"] { background: var(--leo-pop-bar); color: var(--leo-pop-bar-fg); }
.g-select { border-radius: 0; background: var(--leo-pop-bg); color: var(--leo-pop-fg); }
.g-row { gap: 8px; }
.g-side { gap: 10px; }
.g-stat { font-size: 14px; letter-spacing: .02em; }
.g-pad { gap: 8px; }

/* Boards: crisp frame and squares; sharper pieces. */
.bd { border: 3px solid var(--leo-pop-line); box-shadow: 0 0 0 3px var(--leo-pop-bg), 0 0 0 5px #c9a227; }
.bd-sq.l { background: #eedcb5; } .bd-sq.d { background: #9a6a3f; }
.bd-sq.sel { box-shadow: inset 0 0 0 3px #D4A537, inset 0 0 0 5px rgba(23, 37, 84, .35); }
.pc-w { color: #fff; text-shadow: 1px 0 0 #000, -1px 0 0 #000, 0 1px 0 #000, 0 -1px 0 #000, 0 2px 2px rgba(0, 0, 0, .45); }
.pc-b { color: #111; text-shadow: 1px 0 0 rgba(255, 255, 255, .7), -1px 0 0 rgba(255, 255, 255, .7), 0 1px 0 rgba(255, 255, 255, .7), 0 -1px 0 rgba(255, 255, 255, .7); }
.ck { box-shadow: inset 0 0 0 3px rgba(255, 255, 255, .18), 0 2px 0 rgba(0, 0, 0, .35); }
.ms-board, .cw-grid { border-width: 3px; }
.g-canvas { border: 3px solid var(--leo-pop-line); }
.g-canvas[aria-label="Snake board"], .g-canvas[aria-label="Blocks board"], .g-canvas[aria-label="Next piece"] { image-rendering: pixelated; image-rendering: crisp-edges; }
.pcard { box-shadow: 0 0 0 1px rgba(15, 23, 42, .3), 0 1px 2px rgba(15, 23, 42, .15); }

@media (max-width: 760px) {
  .hbn-games-menu { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .hbn-games-card { grid-template-columns: 36px minmax(0, 1fr); column-gap: 10px; min-height: 84px; padding: 10px; }
  .hbn-games-card:hover { transform: none; box-shadow: none; }
  .hbn-games-card > .hbn-games-ic { width: 36px; height: 36px; font-size: 18px; }
  .hbn-games-card > .hbn-games-name { font-size: 12.5px; }
  .hbn-games-card > .hbn-games-blurb { grid-column: 1 / -1; font-size: 12px; }
}
/* ===== /HBN games-refresh v1 ===== */
/* ===== HBN games-g1 (Daily Word, Daily Sudoku, Mahjong Solitaire) ===== */
/* Daily Word */
.dw-wrap .g-main { justify-content: center; }
.dw-col { --dw-t: 52px; --dw-kh: 50px; display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; max-width: 520px; margin: 0 auto; }
.dw-grid { display: grid; gap: 5px; }
.dw-row { display: grid; grid-template-columns: repeat(5, var(--dw-t)); gap: 5px; }
.dw-t { width: var(--dw-t); height: var(--dw-t); box-sizing: border-box; border: 2px solid rgba(23, 37, 84, .28); display: flex; align-items: center; justify-content: center;
  font: 700 calc(var(--dw-t) * .52)/1 var(--leo-pop-font); text-transform: uppercase; color: var(--leo-pop-fg); background: var(--leo-pop-bg); }
.dw-t.on { border-color: var(--leo-pop-line); }
.dw-t.s0, .dw-k.s0 { background: #6b7280; border-color: #6b7280; color: #fff; }
.dw-t.s1, .dw-k.s1 { background: #c9a227; border-color: #c9a227; color: #111; }
.dw-t.s2, .dw-k.s2 { background: #1f7a3d; border-color: #1f7a3d; color: #fff; }
.dw-msg { text-align: center; min-height: 1.4em; }
.dw-kb { display: flex; flex-direction: column; gap: 6px; width: 100%; max-width: 500px; touch-action: manipulation; }
.dw-kr { display: flex; gap: 5px; justify-content: center; }
.dw-k { flex: 1 1 0; min-width: 0; max-width: 46px; height: var(--dw-kh); padding: 0; border: 2px solid var(--leo-pop-line); background: var(--leo-pop-inset); color: var(--leo-pop-fg);
  font: 700 15px/1 var(--leo-pop-font); cursor: pointer; -webkit-user-select: none; user-select: none; touch-action: manipulation; }
.dw-k.wide { flex: 1.6 1 0; max-width: 74px; font-size: 12px; letter-spacing: .04em; text-transform: uppercase; }
.dw-k:active { filter: brightness(.9); }
.dw-k:focus-visible { outline: 3px solid #D4A537; outline-offset: 1px; }

/* Daily Sudoku */
.su-col { --su: 44px; display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 0 auto; }
.su-grid { display: grid; grid-template-columns: repeat(9, var(--su)); border: 3px solid var(--leo-pop-line); background: var(--leo-pop-line); gap: 0; }
.su-c { width: var(--su); height: var(--su); box-sizing: border-box; margin: 0; padding: 0; border: 0; border-right: 1px solid rgba(23, 37, 84, .3); border-bottom: 1px solid rgba(23, 37, 84, .3);
  background: #fff; color: #1d4ed8; font: 600 calc(var(--su) * .56)/1 var(--leo-pop-font); cursor: pointer; display: flex; align-items: center; justify-content: center; touch-action: manipulation; }
.su-c:nth-child(9n) { border-right: 0; } .su-c:nth-child(n+73) { border-bottom: 0; }
.su-c.rb { border-right: 3px solid var(--leo-pop-line); } .su-c.bb { border-bottom: 3px solid var(--leo-pop-line); }
.su-c.gv { color: #111; font-weight: 800; }
.su-c.pr { background: #eef2fb; } .su-c.same { background: #dbe4f7; }
.su-c.sel { background: #f6e7b0; box-shadow: inset 0 0 0 2px #c9a227; }
.su-c.bad { color: #b91c1c; background: #fde8e8; }
.su-c:focus-visible { outline: 3px solid #D4A537; outline-offset: -3px; }
.su-notes { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; height: 100%; }
.su-notes i { font: 600 calc(var(--su) * .22)/1 var(--leo-pop-font); font-style: normal; color: #475569; display: flex; align-items: center; justify-content: center; }
.su-pad { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; width: calc(var(--su) * 9 + 6px); }
.su-pad .g-btn { padding: 0; min-height: 44px; font-size: 18px; }
.su-tools { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; width: calc(var(--su) * 9 + 6px); }
.su-tools .g-btn { min-height: 40px; padding: 6px 4px; font-size: 12px; }

/* Mahjong Solitaire */
.mj-wrap .g-main { overflow: hidden; }
.mj-board { position: relative; margin: auto; flex: 0 0 auto; }
.mj-t { position: absolute; box-sizing: border-box; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; line-height: 1;
  background: linear-gradient(#fffdf6, #f3ead2); border: 1px solid #8a7a55; border-radius: 4px; color: #172554; cursor: default;
  box-shadow: 2px 2px 0 #cdb98a, 4px 4px 0 #8a7a55, 4px 5px 4px rgba(0, 0, 0, .25);
  font-family: "Hiragino Sans", "PingFang SC", "Noto Sans CJK SC", "Noto Serif CJK SC", "Microsoft YaHei", var(--leo-pop-font); touch-action: manipulation; -webkit-user-select: none; user-select: none; }
.mj-t[hidden] { display: none; }
.mj-t.free { cursor: pointer; }
.mj-t:not(.free) { filter: brightness(.86) saturate(.8); }
.mj-t.sel { background: linear-gradient(#fff3c4, #f2d98a); border-color: #c9a227; box-shadow: 0 0 0 3px #c9a227, 4px 4px 0 #8a7a55; }
.mj-t.hint { animation: mj-hint .6s ease-in-out 4 alternate; }
@keyframes mj-hint { to { background: #cfe6d6; box-shadow: 0 0 0 3px #1f7a3d, 4px 4px 0 #8a7a55; } }
.mj-t:focus-visible { outline: 3px solid #D4A537; outline-offset: 1px; }
.mj-n { font-weight: 800; font-size: 1.05em; font-family: var(--leo-pop-font); }
.mj-s { font-size: .62em; margin-top: .12em; }
.mj-d { color: #1d4ed8; } .mj-b { color: #15803d; } .mj-c { color: #b91c1c; }
.mj-big { font-size: 1.15em; font-weight: 700; color: #172554; }
.mj-big.mj-R { color: #b91c1c; } .mj-big.mj-G { color: #15803d; }
.mj-box { width: 52%; height: 58%; border: 3px solid #1d4ed8; border-radius: 2px; box-sizing: border-box; }
@media (max-width: 760px) {
  .mj-t { border-radius: 3px; box-shadow: 1px 1px 0 #cdb98a, 3px 3px 0 #8a7a55; }
  .su-pad .g-btn { min-height: 42px; font-size: 16px; }
}
/* ===== /HBN games-g1 ===== */
/* ===== HBN games-g2 (Space Rocks, Sky Guard) ===== */
.ar-wrap .g-main { flex-direction: column; justify-content: center; gap: 8px; }
.ar-cv { image-rendering: auto; }
.ar-ctl { display: grid; grid-template-columns: 1fr 1fr 1.2fr 1.4fr; gap: 6px; max-width: 100%; touch-action: none; -webkit-user-select: none; user-select: none; }
.ar-ctl3 { grid-template-columns: 1fr 1.6fr 1fr; }
.ar-b { min-height: 52px; padding: 0; font-size: 18px; touch-action: none; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
.ar-b.ar-fire { font-size: 14px; letter-spacing: .08em; }
.ar-b.is-on { background: var(--leo-pop-bar); color: var(--leo-pop-bar-fg); }
@media (hover: hover) and (pointer: fine) and (min-width: 761px) { .ar-ctl { display: none; } }
@media (max-width: 760px) { .ar-b { min-height: 50px; } }
/* ===== /HBN games-g2 ===== */
/* ===== HBN games-g3 (Sea Battle, Dino Runner) ===== */
/* Sea Battle */
.sb-col { --sb: 34px; --sbm: 34px; display: flex; gap: 20px; align-items: flex-start; justify-content: center; margin: 0 auto; }
.sb-col.sb-stack { flex-direction: column; align-items: center; gap: 10px; }
.sb-box { display: flex; flex-direction: column; gap: 4px; }
.sb-cap { margin: 0; font: 700 12px/1.2 var(--leo-pop-font); letter-spacing: .1em; text-transform: uppercase; }
.sb-grid { display: grid; grid-template-columns: repeat(10, var(--sb)); border: 3px solid var(--leo-pop-line); background: #0e3a66; }
.sb-me .sb-grid { grid-template-columns: repeat(10, var(--sbm)); }
.sb-c { width: var(--sb); height: var(--sb); box-sizing: border-box; margin: 0; padding: 0; border: 0; border-right: 1px solid rgba(255, 255, 255, .16); border-bottom: 1px solid rgba(255, 255, 255, .16);
  background: #12508a; position: relative; touch-action: manipulation; cursor: crosshair; }
.sb-me .sb-c { width: var(--sbm); height: var(--sbm); cursor: default; }
.sb-c:nth-child(10n) { border-right: 0; } .sb-c:nth-child(n+91) { border-bottom: 0; }
button.sb-c:not(:disabled):hover { background: #1d6fb8; }
button.sb-c:focus-visible { outline: 3px solid #D4A537; outline-offset: -3px; z-index: 1; }
button.sb-c:disabled { cursor: default; }
.sb-c.ship { background: #94a3b8; }
.sb-c.ship.reveal { background: #64748b; }
.sb-c.miss::after, .sb-c.hit::after, .sb-c.sunk::after { content: ""; position: absolute; left: 50%; top: 50%; width: 34%; height: 34%; transform: translate(-50%, -50%); border-radius: 50%; }
.sb-c.miss::after { background: #e2e8f0; width: 22%; height: 22%; }
.sb-c.hit { background: #7f1d1d; } .sb-c.hit::after { background: #f87171; box-shadow: 0 0 0 2px #fecaca; }
.sb-c.sunk { background: #450a0a; } .sb-c.sunk::after { background: #ef4444; width: 46%; height: 46%; border-radius: 2px; }
.sb-me .sb-c.ship.hit, .sb-me .sb-c.ship.sunk { background: #7f1d1d; }
/* Dino Runner */
.dn-wrap .g-main { justify-content: center; }
.dn-box { max-width: 100%; margin: 0 auto; border: 3px solid var(--leo-pop-line); background: #f7f7f7; }
.dn-frame { display: block; width: 100%; height: 300px; border: 0; background: #f7f7f7; }
.dn-wrap .g-note a { color: inherit; font-weight: 700; }
/* ===== /HBN games-g3 ===== */
/* ===== HBN games-g3b (Sea Battle phone layout) ===== */
.sb-row2 { display: contents; }
.sb-info { display: none; }
.sb-col.sb-stack .sb-row2 { display: flex; gap: 10px; align-items: flex-start; width: calc(var(--sb) * 10 + 6px); }
.sb-col.sb-stack .sb-info { display: block; flex: 1 1 auto; margin: 18px 0 0; font: 700 13px/1.35 var(--leo-pop-font); }
@media (max-width: 760px) { .sb-wrap .g-side .g-msg { display: none; } }
/* ===== /HBN games-g3b ===== */
/* ===== HBN games-g4 (Memory, Memory Buttons, Downhill, Photo Puzzle) ===== */
.mc-wrap .g-main { justify-content: center; align-items: center; }
.mc-grid { display: grid; grid-template-columns: repeat(4, var(--mc, 72px)); gap: 8px; margin: 0 auto; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
.mc-card {
  width: var(--mc, 72px); height: calc(var(--mc, 72px) * 1.22); margin: 0; padding: 0; box-sizing: border-box;
  border: 2px solid var(--leo-pop-line); background: #172554; color: #D4A537; cursor: pointer;
  box-shadow: inset 1px 1px 0 var(--leo-pop-hi), inset -1px -1px 0 var(--leo-pop-lo);
  display: flex; align-items: center; justify-content: center; position: relative;
  touch-action: manipulation; -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
}
.mc-card:disabled { cursor: default; }
.mc-card:focus-visible { outline: 3px solid #D4A537; outline-offset: 1px; }
.mc-back { font: 800 calc(var(--mc, 72px) * .22)/1 var(--leo-pop-font); letter-spacing: .08em; }
.mc-face { display: none; width: 86%; height: 86%; }
.mc-face svg { width: 100%; height: 100%; display: block; }
.mc-card.up, .mc-card.ok { background: #fff; }
.mc-card.up .mc-back, .mc-card.ok .mc-back { display: none; }
.mc-card.up .mc-face, .mc-card.ok .mc-face { display: block; }
.mc-card.ok { box-shadow: inset 0 0 0 3px #D4A537; }

.mp-wrap .g-main { justify-content: center; align-items: center; }
.mp-pad { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; width: min(100%, 360px); margin: 0 auto; touch-action: manipulation; }
.mp-btn {
  margin: 0; padding: 0; min-height: 96px; aspect-ratio: 1 / 1; width: 100%;
  border: 3px solid var(--leo-pop-line); cursor: pointer; touch-action: manipulation;
  -webkit-user-select: none; user-select: none; -webkit-touch-callout: none;
  box-shadow: inset 2px 2px 0 rgba(255,255,255,.45), inset -2px -2px 0 rgba(0,0,0,.25);
}
.mp-btn:focus-visible { outline: 3px solid #D4A537; outline-offset: 2px; }
.mp-r { background: #b42318; } .mp-g { background: #1f7a3d; }
.mp-b { background: #1d4ed8; } .mp-y { background: #c9a227; }
.mp-btn.lit { filter: brightness(1.45); box-shadow: 0 0 0 4px #fff, 0 0 22px rgba(255,255,255,.8); }
.mp-btn.no { box-shadow: 0 0 0 4px #7f1d1d; filter: brightness(.7); }
.mp-pad[data-turn="watch"] .mp-btn { cursor: default; }

.dh-wrap .g-main { justify-content: center; align-items: center; overflow: hidden; }
.dh-box {
  background: #c0c0c0; border: 2px solid; border-color: #fff #555 #555 #fff;
  padding: 5px; box-shadow: 2px 2px 0 #000; margin: 0 auto;
}
.dh-cv { display: block; image-rendering: pixelated; image-rendering: crisp-edges; background: #7eb3d9; max-width: 100%; touch-action: none; -webkit-user-select: none; user-select: none; }


@media (max-width: 760px) {
  .mc-grid { gap: 6px; }
  .mp-btn { min-height: 88px; }
  .mp-pad { gap: 10px; width: min(100%, 320px); }
  .dh-box { padding: 2px; }
}
/* Photo Puzzle (sliding tiles). Board size is set by games.js to fit the tab. */
.pz-wrap .g-main { justify-content: center; align-items: center; overflow: hidden; }
.pz-fig { display: flex; flex-direction: column; align-items: center; gap: 4px; margin: 0; }
.pz-board { position: relative; width: 300px; height: 300px; background: #0b1638; border: 2px solid var(--leo-pop-line); box-sizing: content-box; overflow: hidden; touch-action: manipulation; -webkit-user-select: none; user-select: none; }
.pz-tile { position: absolute; left: 0; top: 0; margin: 0; padding: 0; border: 0; border-radius: 0; background-color: #172554; background-repeat: no-repeat; box-shadow: inset 0 0 0 1px rgba(255,255,255,.55), inset 0 0 0 2px rgba(0,0,0,.25); cursor: pointer; transition: transform .12s ease-out; touch-action: manipulation; -webkit-tap-highlight-color: transparent; }
.pz-tile:focus-visible { outline: 3px solid #D4A537; outline-offset: -3px; z-index: 1; }
.pz-blank { visibility: hidden; }
.pz-done .pz-tile { box-shadow: none; cursor: default; }
.pz-done .pz-blank { visibility: visible; }
.pz-credit { margin: 0; font-size: 11px; line-height: 1.35; color: var(--leo-pop-muted); text-align: center; }
.pz-credit a { color: inherit; font-weight: 700; }
.pz-ctl { height: auto; border-bottom: 0; }
.pz-ctl .g-btn { flex: 0 0 auto; }
@media (prefers-reduced-motion: reduce) { .pz-tile { transition: none; } }
@media (max-width: 760px) {
  .pz-wrap .g-side .g-msg { font-size: 13px; }
  .pz-ctl .g-btn { min-height: 36px; padding: 7px 10px; }
}
/* Fit: Memory Buttons scales to the space left in the tab (no scrolling). */
@supports (container-type: size) {
  .mp-wrap .g-main { container-type: size; }
  .mp-pad { width: min(100%, 360px, 100cqh); }
  .mp-btn { min-height: 0; }
  @media (max-width: 760px) { .mp-btn { min-height: 0; } .mp-pad { width: min(100%, 320px, 100cqh); } }
}
/* Fit: while a game is open on a phone, the page behind the Games pop-up does not scroll. */
@media (max-width: 760px) {
  html:has(.hbn-games-paper.in-game) { height: 100%; overflow: hidden; }
  html:has(.hbn-games-paper.in-game) body { height: 100%; box-sizing: border-box; overflow: hidden; }
}
/* ===== /HBN games-g4 ===== */
