/* Hi Ha Ho — esthétique rétro (complète styles.css) */

@import url("https://fonts.googleapis.com/css2?family=Press+Start+2P&family=VT323&display=swap");

html:has(body.hhh-layout) {
  height: 100%;
}

.hhh-page {
  --hhh-bg: #0c0b10;
  --hhh-panel: #16121f;
  --hhh-line: #3d2f55;
  --hhh-green: #3ecf8e;
  --hhh-amber: #ffb020;
  --hhh-ha-pair: rgba(186, 168, 255, 0.92);
  --hhh-magenta: #ff4da6;
  --hhh-cyan: #5ce1ff;
  --hhh-text: #e8e4f0;
  --hhh-muted: #8a8199;
  --hhh-pixel: "Press Start 2P", monospace;
  --hhh-body: "VT323", monospace;
}

/* Plein écran utile (iPhone, encoche) */
body.hhh-layout {
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}

body.hhh-layout .site-header {
  flex-shrink: 0;
}

body.hhh-layout main.hhh-page.page {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  max-width: none;
  width: 100%;
  margin: 0;
  padding: 0.15rem 0 max(0.35rem, env(safe-area-inset-bottom));
  padding-left: max(0.35rem, env(safe-area-inset-left));
  padding-right: max(0.35rem, env(safe-area-inset-right));
}

body.hhh-layout #hhh-app {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
}

.hhh-wrap {
  font-family: var(--hhh-body);
  font-size: clamp(1.15rem, 3.6vw, 1.4rem);
  line-height: 1.25;
  color: var(--hhh-text);
  background: var(--hhh-bg);
  border: 3px solid rgba(155, 140, 255, 0.5);
  border-radius: 6px;
  box-shadow:
    inset 0 0 0 2px rgba(0, 0, 0, 0.55),
    inset 0 0 50px rgba(0, 0, 0, 0.45),
    0 0 0 1px rgba(255, 255, 255, 0.06),
    0 8px 32px rgba(0, 0, 0, 0.35);
  position: relative;
  overflow: hidden;
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
  width: 100%;
  margin: 0 max(0.25rem, env(safe-area-inset-left)) 0 max(0.25rem, env(safe-area-inset-right));
  max-width: calc(100% - max(0.5rem, env(safe-area-inset-left) + env(safe-area-inset-right)));
  width: calc(100% - max(0.5rem, env(safe-area-inset-left) + env(safe-area-inset-right)));
}

/* Texture discrète sous le contenu */
.hhh-wrap::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  opacity: 0.5;
  background-image:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 2px,
      rgba(0, 0, 0, 0.12) 2px,
      rgba(0, 0, 0, 0.12) 3px
    ),
    repeating-linear-gradient(
      -28deg,
      transparent,
      transparent 8px,
      rgba(155, 140, 255, 0.06) 8px,
      rgba(155, 140, 255, 0.06) 9px
    ),
    radial-gradient(ellipse 80% 50% at 50% 0%, rgba(155, 140, 255, 0.12), transparent 55%);
}

.hhh-wrap .hhh-title {
  flex-shrink: 0;
}

.hhh-wrap #hhh-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  min-height: 0;
}

/* Écran sélection : titre détaché, corps équilibré en hauteur */
.hhh-wrap--select .hhh-title {
  padding-top: clamp(0.85rem, 4.5vh, 2.25rem);
  padding-bottom: 0.35rem;
  margin-bottom: clamp(0.85rem, 3.2vh, 1.65rem);
}

#hhh-body.hhh-body--select {
  --hhh-select-rhythm: clamp(0.45rem, 2vh, 0.95rem);
  justify-content: flex-start;
  padding-top: 0;
  /* Même pas entre : libellé ↔ ligne difficulté ↔ bloc perso ↔ pied */
  gap: var(--hhh-select-rhythm);
}

#hhh-body.hhh-body--select .hhh-diff-row {
  flex-shrink: 0;
}

/* Bloc perso : même écart « boutons diff. → titre » que « titre → grille » ; le vide restant va sous la grille */
#hhh-body.hhh-body--select .hhh-select-char-block {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

#hhh-body.hhh-body--select .hhh-select-char-inner {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: var(--hhh-select-rhythm);
}

#hhh-body.hhh-body--select .hhh-select-char-block::after {
  content: "";
  flex: 1 1 auto;
  min-height: 0;
}

#hhh-body.hhh-body--select .hhh-select-char-inner .hhh-select-grid {
  flex: 0 1 auto;
  align-content: start;
  padding-top: 0;
  padding-bottom: 0.35rem;
}

#hhh-body.hhh-body--select .hhh-select-footer {
  flex-shrink: 0;
  padding-top: 0;
  margin-top: 0;
}

.hhh-wrap--play .hhh-title {
  padding-top: 0.45rem;
}

.hhh-wrap::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 0, 0, 0.12),
    rgba(0, 0, 0, 0.12) 1px,
    transparent 1px,
    transparent 3px
  );
  opacity: 0.35;
  z-index: 2;
}

.hhh-wrap > * {
  position: relative;
  z-index: 1;
}

.hhh-title {
  font-family: var(--hhh-pixel);
  font-size: clamp(0.55rem, 2.8vw, 0.65rem);
  line-height: 1.5;
  letter-spacing: 0.06em;
  text-align: center;
  padding: 0.5rem 0.5rem 0.35rem;
  color: var(--hhh-amber);
  text-shadow: 0 0 12px rgba(255, 176, 32, 0.35);
}

/* Libellés de section : casse normale (évite « É » pixelisé en capitales) */
.hhh-select-heading {
  flex-shrink: 0;
  text-align: center;
  font-family: var(--hhh-pixel);
  font-size: clamp(0.42rem, 2.2vw, 0.52rem);
  line-height: 1.45;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--hhh-muted);
  margin: 0;
  padding: 0.1rem 0.5rem 0;
}

.hhh-diff-row {
  display: flex;
  flex-direction: row;
  gap: 0.4rem;
  padding: 0 0.45rem 0;
  justify-content: stretch;
}

.hhh-diff-btn {
  flex: 1 1 0;
  min-width: 0;
  font-family: var(--hhh-pixel);
  font-size: clamp(0.32rem, 1.85vw, 0.4rem);
  line-height: 1.45;
  padding: 0.55rem 0.2rem;
  border: 3px solid var(--hhh-line);
  border-radius: 2px;
  background: var(--hhh-panel);
  color: var(--hhh-muted);
  cursor: pointer;
  text-transform: uppercase;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 3px 3px 0 #0a080d;
  transition: transform 0.08s ease, box-shadow 0.08s ease, color 0.12s ease,
    border-color 0.12s ease;
}

.hhh-diff-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #0a080d;
}

.hhh-diff-btn:focus-visible {
  outline: 2px solid var(--hhh-cyan);
  outline-offset: 2px;
}

.hhh-diff-btn--on {
  color: var(--hhh-text);
  border-color: rgba(94, 225, 255, 0.65);
  box-shadow:
    3px 3px 0 #0a080d,
    0 0 14px rgba(94, 225, 255, 0.22);
}

.hhh-select-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem;
  padding: 0.35rem 0.5rem 0.65rem;
  flex: 0 1 auto;
  align-content: start;
}

.hhh-pick--solo-last {
  grid-column: 1 / -1;
  width: min(52%, 11.5rem);
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
  justify-self: center;
}

.hhh-pick {
  font-family: var(--hhh-pixel);
  font-size: 0.45rem;
  line-height: 1.5;
  padding: 0.85rem 0.35rem;
  border: 3px solid var(--hhh-line);
  border-radius: 2px;
  background: var(--hhh-panel);
  color: var(--hhh-text);
  cursor: pointer;
  text-transform: uppercase;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 3px 3px 0 #0a080d;
  transition: transform 0.08s ease, box-shadow 0.08s ease;
}

.hhh-pick:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #0a080d;
}

.hhh-pick:focus-visible {
  outline: 2px solid var(--hhh-cyan);
  outline-offset: 2px;
}

.hhh-pick--selected {
  border-color: rgba(94, 225, 255, 0.75);
  color: var(--hhh-cyan);
  box-shadow:
    3px 3px 0 #0a080d,
    0 0 16px rgba(94, 225, 255, 0.28);
}

.hhh-select-footer {
  width: 100%;
  padding: 0 0.5rem 0.35rem;
  box-sizing: border-box;
}

.hhh-btn-start {
  width: 100%;
  font-family: var(--hhh-pixel);
  font-size: clamp(0.48rem, 2.5vw, 0.58rem);
  line-height: 1.5;
  padding: 0.75rem 0.5rem;
  border: 3px solid var(--hhh-green);
  border-radius: 2px;
  background: rgba(62, 207, 142, 0.18);
  color: var(--hhh-green);
  cursor: pointer;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 4px 4px 0 #0a080d;
  transition: transform 0.08s ease, box-shadow 0.08s ease, opacity 0.15s ease;
}

.hhh-btn-start:active:not(:disabled) {
  transform: translate(2px, 2px);
  box-shadow: 2px 2px 0 #0a080d;
}

.hhh-btn-start:focus-visible {
  outline: 2px solid var(--hhh-cyan);
  outline-offset: 2px;
}

.hhh-btn-start:disabled {
  opacity: 0.42;
  cursor: not-allowed;
  border-color: var(--hhh-line);
  color: var(--hhh-muted);
  background: var(--hhh-panel);
  box-shadow: 2px 2px 0 #0a080d;
}

.hhh-pick--with-face {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding-top: 0.55rem;
  padding-bottom: 0.55rem;
}

.hhh-pick__avatar {
  width: clamp(2.1rem, 12vw, 2.75rem);
  height: clamp(2.1rem, 12vw, 2.75rem);
  border: 2px solid var(--hhh-line);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--hhh-pixel);
  font-size: 0.45rem;
  overflow: hidden;
  background: #1e1830;
  box-shadow: 2px 2px 0 #08060c;
}

.hhh-pick__photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: contrast(1.12) saturate(0.88);
}

.hhh-pick__name {
  font-family: var(--hhh-pixel);
  font-size: 0.38rem;
  line-height: 1.3;
  color: var(--hhh-text);
}

.hhh-stage {
  position: relative;
  width: 100%;
  flex: 1 1 auto;
  min-height: 0;
  margin: 0 auto;
  z-index: 0;
}

.hhh-designation-svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 1;
}

.hhh-ring {
  position: absolute;
  inset: 8% 6% 22%;
  border: 2px dashed rgba(94, 225, 255, 0.25);
  border-radius: 50%;
}

.hhh-player {
  position: absolute;
  z-index: 2;
  width: min(28%, 6.25rem);
  max-width: 6.5rem;
  transform: translate(-50%, -50%);
  text-align: center;
  transition: opacity 0.35s ease, filter 0.35s ease;
}

.hhh-player--out {
  opacity: 0.28;
  filter: grayscale(1);
}

.hhh-player__avatar {
  width: 100%;
  aspect-ratio: 1;
  margin: 0 auto;
  border: 3px solid var(--hhh-line);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--hhh-pixel);
  font-size: clamp(0.55rem, 3.5vw, 0.7rem);
  box-shadow: 4px 4px 0 #08060c;
  background: #1e1830;
}

.hhh-player__avatar--photo {
  overflow: hidden;
  padding: 0;
}

.hhh-player__photo {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 20%;
  display: block;
  image-rendering: pixelated;
  image-rendering: crisp-edges;
  filter: contrast(1.12) saturate(0.88);
}

/* Meneur du tour (Hi + Ho + désignation) — jaune (#ffb020) */
.hhh-player--leader .hhh-player__avatar {
  border-color: var(--hhh-amber);
  box-shadow:
    0 0 0 2px rgba(255, 176, 32, 0.4),
    4px 4px 0 #08060c;
}

/* Les deux Ha — même encadrement (violet doux, proche du violet du site) */
.hhh-player--ha-pair:not(.hhh-player--leader) .hhh-player__avatar {
  border-color: var(--hhh-ha-pair);
  box-shadow:
    0 0 0 1px rgba(186, 168, 255, 0.35),
    4px 4px 0 #08060c;
}

/* Qui parle maintenant : halo sans effacer jaune / violet des rôles */
.hhh-player--active .hhh-player__avatar {
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.78),
    0 0 14px rgba(94, 225, 255, 0.35),
    4px 4px 0 #08060c;
}

.hhh-player--active.hhh-player--leader .hhh-player__avatar {
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.85),
    0 0 16px rgba(255, 176, 32, 0.45),
    0 0 0 2px rgba(255, 176, 32, 0.35),
    4px 4px 0 #08060c;
}

.hhh-player--active.hhh-player--ha-pair:not(.hhh-player--leader) .hhh-player__avatar {
  box-shadow:
    0 0 0 2px rgba(255, 255, 255, 0.78),
    0 0 14px rgba(186, 168, 255, 0.4),
    0 0 0 1px rgba(186, 168, 255, 0.45),
    4px 4px 0 #08060c;
}

.hhh-player--human .hhh-player__avatar {
  outline: 2px solid var(--hhh-cyan);
  outline-offset: 2px;
}

.hhh-player--selectable .hhh-player__avatar {
  cursor: pointer;
  animation: hhh-pulse 1s ease-in-out infinite;
}

@keyframes hhh-pulse {
  50% {
    border-color: var(--hhh-magenta);
  }
}

.hhh-player__name {
  font-family: var(--hhh-pixel);
  font-size: 0.38rem;
  margin-top: 0.35rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--hhh-muted);
}

.hhh-player--leader .hhh-player__name {
  color: var(--hhh-amber);
}

.hhh-player--ha-pair:not(.hhh-player--leader) .hhh-player__name {
  color: rgba(200, 188, 255, 0.95);
}

.hhh-player--active.hhh-player--ha-pair:not(.hhh-player--leader) .hhh-player__name {
  color: rgba(220, 210, 255, 1);
}

.hhh-hud {
  flex-shrink: 0;
  padding: 0.3rem 0.5rem 0.4rem;
  min-height: 2.85rem;
}

.hhh-hud__line {
  font-size: clamp(1.05rem, 3.5vw, 1.25rem);
  text-align: center;
  color: var(--hhh-cyan);
  min-height: 1.5em;
}

.hhh-hud__hint {
  font-size: clamp(0.9rem, 3vw, 1.05rem);
  text-align: center;
  color: var(--hhh-muted);
  margin-top: 0.15rem;
}

.hhh-timer {
  flex-shrink: 0;
  height: 6px;
  margin: 0.35rem 0.5rem 0;
  background: #0a080d;
  border: 2px solid var(--hhh-line);
  border-radius: 1px;
  overflow: hidden;
}

.hhh-timer__bar {
  height: 100%;
  width: 100%;
  transform-origin: left center;
  background: linear-gradient(90deg, var(--hhh-magenta), var(--hhh-amber));
  transition: transform 0.05s linear;
}

.hhh-actions {
  flex-shrink: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.4rem;
  padding: 0.4rem 0.5rem 0.5rem;
}

.hhh-btn {
  font-family: var(--hhh-pixel);
  font-size: clamp(0.45rem, 2.8vw, 0.55rem);
  line-height: 1.4;
  padding: 0.85rem 0.2rem;
  border: 3px solid var(--hhh-line);
  border-radius: 2px;
  background: #241c36;
  color: var(--hhh-text);
  cursor: pointer;
  text-transform: uppercase;
  -webkit-tap-highlight-color: transparent;
  box-shadow: 3px 3px 0 #08060c;
}

.hhh-btn:active {
  transform: translate(2px, 2px);
  box-shadow: 1px 1px 0 #08060c;
}

.hhh-btn--hidden {
  visibility: hidden;
  pointer-events: none;
}

.hhh-log {
  flex-shrink: 0;
  font-size: clamp(0.88rem, 2.8vw, 1rem);
  color: var(--hhh-muted);
  padding: 0 0.5rem 0.45rem;
  max-height: 3.2em;
  overflow: hidden;
  text-align: center;
}

.hhh-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  background: rgba(6, 4, 10, 0.92);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  padding: 1rem;
  text-align: center;
}

.hhh-overlay h2 {
  font-family: var(--hhh-pixel);
  font-size: 0.55rem;
  line-height: 1.7;
  color: var(--hhh-amber);
  margin: 0;
}

.hhh-overlay p {
  margin: 0;
  font-size: 1.15rem;
  color: var(--hhh-muted);
  max-width: 18em;
}

.hhh-overlay__actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 0.35rem;
}

.hhh-overlay .hhh-pick {
  min-width: 8rem;
}

.hhh-hidden {
  display: none !important;
}
