/* ── HERO PLAY: expandable game panel inside the hero grid field ── */

.hn-hero-img {
  transition: height 0.5s cubic-bezier(0.65, 0, 0.35, 1);
}
.hn-hero-img.hp-active {
  aspect-ratio: unset;
}
.hn-hero-img.hp-active::before {
  -webkit-mask-image: none;
  mask-image: none;
  transition: background-size 0.5s ease;
}

#hn-token-field .hn-token,
#hn-token-field .hn-hero-name,
#hn-token-field .hn-token-reset {
  transition: opacity 0.25s ease;
}
#hn-token-field.hp-mode .hn-token,
#hn-token-field.hp-mode .hn-hero-name,
#hn-token-field.hp-mode .hn-token-reset {
  opacity: 0;
  pointer-events: none;
}

.hp-root {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: 32px 16px;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease 0.1s;
}
#hn-token-field.hp-mode .hp-root { opacity: 1; pointer-events: auto; }

.hp-gameover {
  position: absolute;
  inset: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.22s ease;
}
.hp-gameover.show { opacity: 1; }
.hp-gameover-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 18px;
  padding: 32px 40px;
  border-radius: 18px;
  background: #1e1c18;
  border: 1px solid rgba(255,255,255,0.12);
  box-shadow: 0 20px 48px rgba(0,0,0,0.4);
  transform: scale(0.92) translateY(6px);
  transition: transform 0.25s cubic-bezier(0.34, 1.4, 0.64, 1);
  pointer-events: auto;
}
.hp-gameover.show .hp-gameover-card { transform: scale(1) translateY(0); }
.theme-light .hp-gameover-card { background: #ffffff; border-color: rgba(0,0,0,0.1); }
.hp-gameover-left {
  justify-content: flex-start;
  padding-left: clamp(20px, 6%, 60px);
}
.hp-gameover-left .hp-gameover-card { transform: scale(0.92) translate(-6px, 0); }
.hp-gameover-left.show .hp-gameover-card { transform: scale(1) translate(0, 0); }
.hp-gameover-msg {
  font-family: var(--serif);
  font-size: clamp(20px, 3vw, 26px);
  color: #f8f6f1;
  text-align: center;
}
.theme-light .hp-gameover-msg { color: #1e1c18; }
.hp-gameover-actions {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  justify-content: center;
}
.hp-gameover-btn {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  background: transparent;
  color: var(--rose);
  border: 1px solid var(--rose);
  border-radius: 20px;
  padding: 10px 22px;
  cursor: none;
  opacity: 0.85;
  transition: opacity 0.2s, background 0.2s;
}
.hp-gameover-btn:hover { opacity: 1; background: color-mix(in srgb, var(--rose) 14%, transparent); }
.hp-gameover-btn-ghost {
  color: inherit;
  border-color: var(--bord2, rgba(255,255,255,0.25));
}
.hp-gameover-btn-ghost:hover { background: rgba(255,255,255,0.06); }

.hp-topbar {
  position: absolute;
  top: 18px;
  left: 0;
  right: 0;
  display: flex;
  justify-content: center;
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.hp-back, .hp-reset {
  position: absolute;
  top: 18px;
  background: #1e1c18;
  border: 1px solid transparent;
  color: #f8f6f1;
  border-radius: 20px;
  padding: 7px 14px;
  cursor: none;
  opacity: 0.85;
  transition: opacity 0.2s;
}
.theme-light .hp-back, .theme-light .hp-reset { background: #f8f6f1; color: #1e1c18; }
.hp-back { left: 24px; }
.hp-reset { right: 24px; }
.hp-back:hover, .hp-reset:hover { opacity: 1; }
.hp-back-under {
  position: static;
}
.hp-status {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 9px;
  font-family: var(--serif);
  font-size: clamp(15px, 2vw, 19px);
  font-style: normal;
  text-transform: none;
  letter-spacing: normal;
  min-height: 1.4em;
}
.hp-status-dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
  box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 20%, transparent);
  animation: hp-status-pulse 1.6s ease-in-out infinite;
}
.hp-status-dot.x, .hp-status-dot.p1 { background: var(--rose); color: var(--rose); }
.hp-status-dot.o, .hp-status-dot.p2 { background: #cfa15a; color: #cfa15a; }
@keyframes hp-status-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(0.8); opacity: 0.7; }
}

/* game picker */
.hp-picker, .hp-mode-select {
  display: flex;
  gap: 14px;
  flex-wrap: wrap;
  justify-content: center;
}
.hp-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  width: 140px;
  padding: 20px 12px;
  border: 1px solid var(--bord2, rgba(255,255,255,0.2));
  border-radius: 16px;
  background: #1e1c18;
  color: #f8f6f1;
  cursor: none;
  font-family: var(--serif);
  font-size: 14px;
  font-style: normal;
  transition: transform 0.2s ease, border-color 0.2s ease;
}
.theme-light .hp-card { background: #ffffff; color: #1e1c18; }
.hp-card:hover { transform: translateY(-3px); border-color: var(--rose); }
.hp-card-icon {
  width: 34px;
  height: 34px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--rose) 16%, transparent);
  color: var(--rose);
  display: flex;
  align-items: center;
  justify-content: center;
}
.hp-card-icon svg { display: block; width: 17px; height: 17px; }
.hp-mobile-note { display: none; font-family: var(--mono); font-size: 11px; letter-spacing: 0.06em; opacity: 0.6; text-align: center; }

@media (max-width: 768px) {
  .hp-card[data-game="connect4"], .hp-card[data-game="checkers"] { display: none; }
  .hp-mobile-note { display: block; }
}

/* boards */
.hp-board-wrap {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}

.hp-board-box { position: relative; display: inline-block; }
.hp-board-ttt, .hp-board-c4, .hp-board-cb { transition: opacity 0.35s ease; }
.hp-intro-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}
.hp-intro-svg.hp-intro-fade { opacity: 0; transition: opacity 0.3s ease; }
.hp-intro-line {
  stroke: rgba(140,140,140,0.55);
  stroke-width: 1;
  stroke-linecap: round;
  transition: stroke-dashoffset 0.38s cubic-bezier(0.65, 0, 0.35, 1);
}

.hp-board-ttt {
  display: grid;
  grid-template-columns: repeat(3, var(--hp-cell, 84px));
  grid-template-rows: repeat(3, var(--hp-cell, 84px));
}
.hp-board-ttt .hp-cell {
  border: 1px solid var(--bord2, rgba(255,255,255,0.25));
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: none;
  font-family: var(--serif);
  font-size: calc(var(--hp-cell, 84px) * 0.5);
  color: var(--rose);
}
.hp-board-ttt .hp-cell:not(:empty) { cursor: none; }
.hp-ttt-tile {
  width: 74%;
  height: 74%;
  border-radius: 8px;
  box-shadow: inset 0 -2px 3px rgba(0,0,0,0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--serif);
  font-weight: 700;
  font-size: calc(var(--hp-cell, 84px) * 0.34);
  color: rgba(255,255,255,0.92);
}
.hp-ttt-tile.x { background: var(--rose); }
.hp-ttt-tile.o { background: #cfa15a; }

.hp-board-c4 {
  position: relative;
  display: grid;
  grid-template-columns: repeat(7, var(--hp-cell, 52px));
  grid-auto-rows: var(--hp-cell, 52px);
  gap: 6px;
  padding: 10px;
  border-radius: 14px;
  background: #1e1c18;
  box-shadow: 0 12px 28px rgba(0,0,0,0.35);
}
.theme-light .hp-board-c4 { background: #ffffff; box-shadow: 0 12px 28px rgba(0,0,0,0.18); }
.hp-c4-cell {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: rgba(0,0,0,0.28);
  box-shadow: inset 0 2px 3px rgba(0,0,0,0.35);
  cursor: none;
}
.hp-c4-cell.p1 { background: var(--rose); box-shadow: inset 0 -2px 3px rgba(0,0,0,0.2); }
.hp-c4-cell.p2 { background: #cfa15a; box-shadow: inset 0 -2px 3px rgba(0,0,0,0.2); }
.hp-c4-cell.win.p1 { animation: hp-c4-win-glow-rose 1s ease-in-out infinite; }
.hp-c4-cell.win.p2 { animation: hp-c4-win-glow-gold 1s ease-in-out infinite; }
@keyframes hp-c4-win-glow-rose {
  0%, 100% { box-shadow: inset 0 -2px 3px rgba(0,0,0,0.2), 0 0 10px 3px color-mix(in srgb, var(--rose) 65%, transparent); }
  50% { box-shadow: inset 0 -2px 3px rgba(0,0,0,0.2), 0 0 18px 7px color-mix(in srgb, var(--rose) 90%, transparent); }
}
@keyframes hp-c4-win-glow-gold {
  0%, 100% { box-shadow: inset 0 -2px 3px rgba(0,0,0,0.2), 0 0 10px 3px rgba(255,209,102,0.65); }
  50% { box-shadow: inset 0 -2px 3px rgba(0,0,0,0.2), 0 0 18px 7px rgba(255,209,102,0.95); }
}

.hp-c4-drop {
  position: absolute;
  border-radius: 50%;
  pointer-events: none;
  z-index: 2;
}
.hp-c4-drop.p1 { background: var(--rose); }
.hp-c4-drop.p2 { background: #cfa15a; }

.hp-c4-next {
  display: flex;
  align-items: center;
  gap: 10px;
}
.hp-c4-next-disc {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  cursor: none;
  transition: transform 0.15s ease;
}
.hp-c4-next-disc.p1 { background: var(--rose); }
.hp-c4-next-disc.p2 { background: #cfa15a; }
.hp-c4-next-disc:active { cursor: none; }
.hp-c4-next-disc.disabled { opacity: 0.35; cursor: none; pointer-events: none; }
.hp-c4-next-label {
  font-family: var(--mono);
  font-size: 8.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0.85;
  padding: 7px 14px;
  border-radius: 20px;
  border: 1px solid var(--bord2, rgba(255,255,255,0.2));
  background: rgba(0,0,0,0.1);
}

.hp-board-cb {
  display: grid;
  grid-template-columns: repeat(8, var(--hp-cell, 48px));
  grid-template-rows: repeat(8, var(--hp-cell, 48px));
  border: 1px solid var(--bord2, rgba(255,255,255,0.25));
}
.hp-cb-cell { display: flex; align-items: center; justify-content: center; }
.hp-cb-cell.dark { background: rgba(0,0,0,0.14); cursor: none; }
.hp-cb-cell.dark.hint { box-shadow: inset 0 0 0 3px var(--rose); }
.hp-piece {
  width: 72%;
  height: 72%;
  border-radius: 50%;
  cursor: none;
  user-select: none;
  box-shadow: 0 2px 4px rgba(0,0,0,0.35);
}
.hp-piece.p1 { background: var(--rose); }
.hp-piece.p2 { background: #2c2a24; border: 1px solid rgba(255,255,255,0.2); }
.hp-piece.king { position: relative; }
.hp-piece.king::after {
  content: '♛';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9em;
  color: rgba(255,255,255,0.85);
}
.hp-piece.selected { outline: 2px solid #fff; outline-offset: -2px; }
.hp-piece.draggable { cursor: none; touch-action: none; }
