/* Higher or Lower on the big screen: the live board (countdown, choosing, reveal, final two, between games).
   Stage pixels (see 16_main_shell.css). Plain DOM driven by play_your_cards_right_board_controller.js, which sets
   --hol-av, --hol-card-scale on .gtf-hol; the player tokens are a Pixi canvas (board.js). */

.gtf-hol-screen {
  --hol-amber: oklch(0.78 0.16 70);
  --hol-border: var(--gtf-surface-3);
  --hol-panel: var(--gtf-surface-1);
  /* The design sizes its type with clamp(min, N vw, max); the stage's logical width plays the window width. */
  --hol-vw: calc(var(--gtf-stage-w, 1920px) / 100);
}

.gtf-hol {
  --hol-av: 56px;
  --hol-av-font: 20px;
  --hol-ring: 4px;
  --hol-card-scale: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  height: 100%;
}

/* ---------- Title, still-in figure, timer ---------- */

.gtf-hol__top {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 24px;
}

.gtf-hol__title {
  font-size: clamp(32px, calc(var(--hol-vw) * 4), 56px);
  line-height: 1.05;
  letter-spacing: -0.03em;
  font-weight: 900;
}

.gtf-hol__sub {
  min-height: 30px;
  margin-top: 6px;
  font-size: clamp(18px, calc(var(--hol-vw) * 1.8), 24px);
  color: var(--gtf-text-2);
}

.gtf-hol__still {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

.gtf-hol__still-label {
  font-size: 24px;
  color: var(--gtf-text-2);
}

.gtf-hol__still-count {
  font-family: var(--gtf-mono);
  font-size: clamp(48px, calc(var(--hol-vw) * 6), 80px);
  line-height: 1;
}

.gtf-hol__bar {
  height: 14px;
  flex: none;
  border-radius: 7px;
  background: var(--gtf-surface-3);
  overflow: hidden;
}

.gtf-hol__bar-fill {
  width: 0;
  height: 100%;
  border-radius: 7px;
  background: var(--hol-amber);
}

/* ---------- Board: two zones, the cards between them, players along the bottom ---------- */

.gtf-hol__board {
  position: relative;
  flex: 1 1 0;
  min-height: 0;
}

.gtf-hol__zone {
  position: absolute;
  top: 0;
  width: 36%;
  bottom: 0;
  border: 2px solid var(--hol-border);
  border-radius: 14px;
  background: var(--hol-panel);
  transition: border-color 0.4s;

  &.gtf-hol__zone--lower { left: 0; }
  &.gtf-hol__zone--higher { right: 0; }
  &.is-win { border-color: var(--gtf-success); }
  &.is-lose { border-color: var(--gtf-orange); }
}

.gtf-hol__zone-head {
  display: flex;
  justify-content: space-between;
  padding: 14px 18px;
  font-size: clamp(22px, calc(var(--hol-vw) * 2.4), 34px);
  font-weight: 900;
  line-height: 1.1;
}

.gtf-hol__zone-count {
  font-family: var(--gtf-mono);
  font-weight: 400;
  color: var(--gtf-text-2);
}

.gtf-hol__note {
  min-height: 24px;
  padding: 0 18px;
  font-size: 22px;
  color: var(--hol-amber);
}

/* ---------- Cards ---------- */

/* The cards sit over the zones' inner edges (as in the design): block centred at 50% / 38%, hint line at 68%. */
.gtf-hol__center {
  position: absolute;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.gtf-hol__cards {
  position: absolute;
  top: 38%;
  left: 50%;
  translate: -50% -50%;
  display: flex;
  align-items: center;
  gap: clamp(6px, calc(var(--hol-vw) * 0.8), 14px);
}

.gtf-hol__cardcol {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}

.gtf-hol__label {
  font-size: clamp(16px, calc(var(--hol-vw) * 1.5), 22px);
  font-weight: 800;
  color: var(--gtf-text-2);
  white-space: nowrap;
}

.gtf-hol__arrow {
  padding-top: 32px;
  font-size: clamp(32px, calc(var(--hol-vw) * 3.4), 56px);
  line-height: 1;
  color: var(--hol-amber);
}

.gtf-hol__cardbox,
.gtf-hol__nextbox {
  --w: calc(clamp(110px, calc(var(--hol-vw) * 11), 200px) * var(--hol-card-scale));
  width: var(--w);
  aspect-ratio: 2 / 3;
}

.gtf-hol__nextbox {
  --w: calc(clamp(70px, calc(var(--hol-vw) * 7), 120px) * var(--hol-card-scale));
  transition: width 0.5s ease-out;

  &.is-reveal { --w: calc(clamp(150px, calc(var(--hol-vw) * 15), 270px) * var(--hol-card-scale)); }
}

.gtf-hol__cardbox { position: relative; }

.gtf-hol__cardbox > .gtf-hol__face {
  position: absolute;
  inset: 0;
}

.gtf-hol__cardbox .gtf-hol__face {
  border-radius: 12px;
  box-shadow: 0 0 0 5px var(--hol-amber);
}

.gtf-hol__face {
  position: relative;
  width: 100%;
  height: 100%;
  border-radius: 10px;

  & img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: fill;
  }

  &.is-pop { animation: gtf-hol-pop 0.45s ease-out both; }
}

.gtf-hol__face--text {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--gtf-cream);
  color: var(--gtf-ink);
  font-weight: 900;
  line-height: 1;

  &.is-red { color: oklch(0.55 0.21 27); }
}

.gtf-hol__face-rank { font-size: calc(var(--w) * 0.5); }
.gtf-hol__face-suit { font-size: calc(var(--w) * 0.34); }

.gtf-hol__slot {
  display: grid;
  place-items: center;
  width: 100%;
  height: 100%;
  border: 3px dashed #4A4036;
  border-radius: 12px;
  background: var(--hol-panel);
  font-size: calc(var(--w) * 0.5);
  font-weight: 900;
  color: var(--gtf-text-2);
}

.gtf-hol__nextbox { position: relative; }

/* The next card turns over: the back narrows to nothing, then the face opens up (a flat flip, no 3D layers). */
.gtf-hol__flip {
  position: absolute;
  inset: 0;
}

.gtf-hol__flip-inner {
  position: absolute;
  inset: 0;

  & > .gtf-hol__face {
    position: absolute;
    inset: 0;
    animation: gtf-hol-flip-in 0.4s ease-out 0.4s both;
  }

  & > .gtf-hol__face--back {
    animation: gtf-hol-flip-out 0.4s ease-in both;
  }

  &.is-flat > .gtf-hol__face { animation: none; }
  &.is-flat > .gtf-hol__face--back { display: none; }
}

.gtf-hol__hint {
  position: absolute;
  top: 68%;
  left: 50%;
  translate: -50% -50%;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: clamp(18px, calc(var(--hol-vw) * 1.8), 26px);
  font-weight: 800;
  color: var(--gtf-text-2);
  white-space: nowrap;
}

.gtf-hol__hint-or { font-weight: 600; }

.gtf-hol.is-countdown .gtf-hol__center,
.gtf-hol.is-winner .gtf-hol__center { opacity: 0; }

/* ---------- Players (Pixi tokens: rounded squares in each player's colour, drawn in board.js) ---------- */

.gtf-hol__avatars {
  z-index: 1;
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.gtf-hol__canvas {
  display: block;
}

/* ---------- Countdown and between-games overlay ---------- */

.gtf-hol__overlay {
  position: absolute;
  inset: 0;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  border-radius: 14px;
  background: rgb(28 24 20 / 0.9);
  text-align: center;

  &[hidden] { display: none; }
}

.gtf-hol__overlay-big {
  font-family: var(--gtf-mono);
  font-size: clamp(140px, calc(var(--hol-vw) * 14.6), 280px);
  line-height: 1;
  color: var(--hol-amber);

  &[hidden] { display: none; }
  &.is-tick { animation: gtf-hol-pop 0.45s ease-out both; }
}

.gtf-hol__overlay-avatar {
  &[hidden] { display: none; }

  & .avatar-component {
    width: 180px;
    height: 180px;
  }

  & .avatar-component__initials { font-size: 64px; }
}

.gtf-hol__overlay-text {
  font-size: clamp(36px, calc(var(--hol-vw) * 2.9), 56px);
  font-weight: 900;
  letter-spacing: -0.03em;
}

.gtf-hol__overlay-sub {
  font-size: 28px;
  color: var(--gtf-text-2);
}

/* ---------- Motion ---------- */

@keyframes gtf-hol-flip-in {
  0% { transform: scaleX(0); }
  100% { transform: scaleX(1); }
}

@keyframes gtf-hol-flip-out {
  0% { transform: scaleX(1); opacity: 1; }
  99% { transform: scaleX(0); opacity: 1; }
  100% { transform: scaleX(0); opacity: 0; }
}

@keyframes gtf-hol-pop {
  0% { scale: 0.5; opacity: 0; }
  100% { scale: 1; opacity: 1; }
}

@keyframes gtf-hol-rise {
  0% { translate: 0 20px; opacity: 0; }
  100% { translate: 0 0; opacity: 1; }
}

.gtf-hol__overlay-text,
.gtf-hol__overlay-sub,
.gtf-hol__overlay-avatar { animation: gtf-hol-rise 0.5s ease-out both; }

@media (prefers-reduced-motion: reduce) {
  .gtf-hol *,
  .gtf-hol *::before,
  .gtf-hol *::after {
    animation-duration: 0.01s !important;
    transition-duration: 0.01s !important;
    transition-delay: 0s !important;
  }
}
