html,
body {
  width: 100vw;
  height: 100vh;
  height: 100svh;
  background: var(--light-colour); /* fallback for old browsers */
  background: -webkit-linear-gradient(
    to right,
    #cfdef3,
    #e0eafc
  ); /* Chrome 10-25, Safari 5.1-6 */
  background: linear-gradient(
    to right,
    #cfdef3,
    #e0eafc
  ); /* W3C, IE 10+/ Edge, Firefox 16+, Chrome 26+, Opera 12+, Safari 7+ */
  overflow: hidden;
}

body {
  display: flex;
  align-items: center;
  justify-content: center;
}

.actionBar {
  position: absolute;
  width: 80%;
  height: 7.5vmin;
  max-width: 800px;
  bottom: 1vmin;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1vmin;
  background-color: rgba(255, 255, 255, 0.35);
  border-top: 1px solid var(--white-colour);
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  box-shadow: rgba(0, 0, 0, 0.1) 0px 2.75vmin 0 -2vmin;
  border-radius: 1vmin;
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px); /* for Safari */
}

.actionBar button {
  width: 50%;
  height: 100%;
  background-color: transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 1vmin;
  opacity: 0.6;
  border: none;
  cursor: pointer;
}

.actionBar button:hover {
  opacity: 1;
  background-color: rgba(255, 255, 255, 0.1);
  background: linear-gradient(
    90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 1) 100%
  );
}

.actionBar:hover button:first-of-type {
  background: linear-gradient(
    -90deg,
    rgba(255, 255, 255, 0) 0%,
    rgba(255, 255, 255, 1) 100%
  );
}

.actionBar button p {
  font-size: 2.5vmin;
  font-weight: 900;
  color: #111;
  text-transform: uppercase;
  user-select: none;
}

.button-holder-divider {
  width: 1px;
  height: 6vmin;
  border-left: 1px solid rgba(0, 0, 0, 0.1);
  border-right: 1px solid rgba(255, 255, 255, 0.25);
}

/* -------------------------------------------------------------------------- */
/*                                   CARDS                                    */
/* -------------------------------------------------------------------------- */

.cardHolder {
  width: 100%;
  height: 100%;
  position: relative;
  overflow: hidden;
}

/* Stage title shown when no cards dealt */
.stage-title {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 7.5vmin;
  font-weight: 900;
  color: rgba(0, 0, 0, 0.2);
  text-align: center;
  max-width: 80%;
  pointer-events: none;
  transition: opacity 0.8s ease-out;
  text-wrap: balance;
  text-shadow: 0 1px 0 rgba(255, 255, 255, 0.6), 0 -1px 0 rgba(0, 0, 0, 0.05);
}

.stage-title.hidden {
  opacity: 0;
}

.card {
  /* Width and height set dynamically by JS */
  aspect-ratio: 3/2;
  background-color: var(--white-colour);
  border-radius: 2vmin;
  box-shadow: rgba(9, 30, 66, 0.25) 0px 4px 8px -2px,
    rgba(9, 30, 66, 0.08) 0px 0px 0px 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1vmin;
  overflow: hidden;
  transform-origin: center center;
  user-select: none;
  container-type: size;
}

.card .card-corner {
  position: absolute;
  top: 0;
  left: 0;
  width: 15%;
  height: auto;
  fill: var(--dark-colour);
  pointer-events: none;
  transform-origin: top left;
}

.card .corner-text {
  font-size: 2.5vmin;
  font-weight: 700;
  fill: var(--white-colour);
}

/* True/False verdict corner (shared trueFalseFace.js) — replaces the
   deal-number triangle while the answer face is showing; triangle fill is
   set inline to match the card's border colour */
.card .tf-corner {
  position: absolute;
  top: 0;
  left: 0;
  width: 15%;
  height: auto;
  pointer-events: none;
  transform-origin: top left;
}

.card .tf-corner .tf-corner-icon {
  fill: var(--white-colour);
}

.card p {
  color: var(--dark-colour);
  font-size: 12cqh; /* Container query height - scales with card */
  font-weight: 300;
  padding: 2cqh 3cqw;
  border-radius: 1cqh;
  width: fit-content;
  height: fit-content;
  max-width: 90%;
  max-height: 90%;
  text-align: center;
  text-wrap: balance;
}

/* Text overlay when card has background image */
/* Back of card (not flipped) - light text on dark bg */
.card[style*='background-image']:not([data-flipped='true']) p {
  color: var(--white-colour);
  background-color: color-mix(in srgb, var(--dark-colour) 90%, transparent);
}

/* Front of card (flipped) - dark text on light bg */
.card[style*='background-image'][data-flipped='true'] p {
  color: var(--dark-colour);
  background-color: color-mix(in srgb, var(--white-colour) 90%, transparent);
}

/* Image-text position 'bottom' (file-level setting, context.textPosition):
   flush full-width caption band that grows upward with extra lines. Image
   cards only — text-only cards stay centred. Cards are positioned (JS sets
   position:absolute) + overflow:hidden, so the band anchors and clips to
   their corners. Colour treatment above still applies per side. */
body.text-pos-bottom .card[style*='background-image'] p {
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  max-width: 100%;
  border-radius: 0;
}
