/* =========================================================
   83 HOOVER — Terminal de piratage (mini-jeu caché)
   Écran cathodique : police monospace, lignes de balayage, halo orange.
   ========================================================= */
.hk-overlay {
  --hk-bg: #0A0A0A;
  --hk-orange: #FF6A00;
  --hk-orange-hi: #FF8C00;
  --hk-gray: #BDBDBD;
  --hk-gray-dim: #6E6E6E;
  --hk-glow: rgba(255, 106, 0, .55);
  --hk-font: "Share Tech Mono", ui-monospace, "Cascadia Mono", Consolas, monospace;

  position: fixed; inset: 0; z-index: 9500;
  display: grid; place-items: center; padding: clamp(.5rem, 2.5vw, 2rem);
  background: rgba(0, 0, 0, .86);
  opacity: 0; transition: opacity .25s ease;
  overscroll-behavior: contain;
}
.hk-overlay[hidden] { display: none; }
.hk-overlay.is-open { opacity: 1; }
html.hk-lock, html.hk-lock body { overflow: hidden; }

.hk-modal {
  width: min(1040px, 100%); max-height: 100%;
  display: flex; flex-direction: column;
  background: var(--hk-bg); color: var(--hk-gray);
  border: 1px solid rgba(255, 106, 0, .45); border-radius: 10px;
  box-shadow: 0 0 0 1px #000, 0 0 60px rgba(255, 106, 0, .18), 0 40px 100px rgba(0, 0, 0, .9);
  font-family: var(--hk-font);
  transform: translateY(14px) scale(.97); transition: transform .35s cubic-bezier(.22, 1, .36, 1);
  overflow: hidden;
}
.hk-overlay.is-open .hk-modal { transform: none; }

/* Barre de fenêtre */
.hk-bar {
  display: flex; align-items: center; gap: .75rem; flex: none;
  padding: .55rem .75rem .55rem .9rem; background: #141414; border-bottom: 1px solid rgba(255, 106, 0, .22);
  font-size: .8rem; color: var(--hk-gray-dim);
}
.hk-dots { display: flex; gap: 6px; }
.hk-dots i { width: 11px; height: 11px; border-radius: 50%; background: var(--hk-orange-hi); }
.hk-dots i:nth-child(2) { background: #8A8A8A; }
.hk-dots i:nth-child(3) { background: #3A3A3A; }
.hk-bar-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hk-icon {
  display: grid; place-items: center; width: 32px; height: 32px; border-radius: 6px;
  background: transparent; border: 1px solid transparent; color: var(--hk-gray); cursor: pointer; font-size: .95rem;
  transition: border-color .2s, color .2s, background .2s;
}
.hk-icon:hover { border-color: rgba(255, 106, 0, .5); color: #fff; background: rgba(255, 106, 0, .1); }
.hk-icon svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; }
.hk-icon:focus-visible, .hk-btn:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.hk-main { position: relative; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.hk-body { flex: 1; min-height: 0; overflow-y: auto; padding: clamp(1rem, 3vw, 1.6rem); }

/* En-tête : titre + règle */
.hk-kicker { font-size: .72rem; letter-spacing: .28em; text-transform: uppercase; color: var(--hk-orange); }
.hk-title {
  margin-top: .45rem;
  font-family: "Anton", Impact, "Arial Narrow", sans-serif; font-weight: 400; text-transform: uppercase;
  font-size: clamp(1.45rem, 3.6vw, 2.3rem); line-height: 1.05; color: #fff;
  text-shadow: 0 0 22px rgba(255, 106, 0, .35);
}
.hk-rules { margin-top: .7rem; max-width: 62rem; font-size: clamp(.86rem, 1.8vw, .95rem); line-height: 1.6; color: var(--hk-gray); }
.hk-help { margin-top: .6rem; display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .4rem; font-size: .76rem; color: var(--hk-gray-dim); }
.hk-help kbd {
  display: inline-grid; place-items: center; min-width: 1.6rem; height: 1.45rem; padding: 0 .3rem;
  border: 1px solid #3A3A3A; border-bottom-width: 2px; border-radius: 4px; background: #151515;
  font-family: var(--hk-font); font-size: .74rem; color: var(--hk-gray);
}
.hk-help span { margin-left: .4rem; }
.hk-help b { color: var(--hk-orange); font-weight: 400; }

/* ---------- Écran CRT ---------- */
.hk-crt {
  position: relative; overflow: hidden; isolation: isolate;
  margin-top: 1.1rem; padding: clamp(.8rem, 2.4vw, 1.25rem);
  border-radius: 14px; border: 1px solid #262626;
  background: radial-gradient(ellipse at center, #140b04 0%, #0A0A0A 70%);
  box-shadow: inset 0 0 70px rgba(0, 0, 0, .95), inset 0 0 18px rgba(255, 106, 0, .12);
  color: var(--hk-orange);
  text-shadow: 0 0 4px var(--hk-glow), 0 0 12px rgba(255, 106, 0, .25);
}
/* Lignes de balayage */
.hk-crt::before {
  content: ""; position: absolute; inset: 0; z-index: 3; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .32) 0 1px, transparent 1px 3px);
}
/* Vignette + barre de rafraîchissement qui descend */
.hk-crt::after {
  content: ""; position: absolute; inset: -10% 0; z-index: 4; pointer-events: none;
  background:
    linear-gradient(180deg, transparent 0%, rgba(255, 140, 0, .06) 50%, transparent 100%) 0 0 / 100% 22% no-repeat,
    radial-gradient(ellipse at center, transparent 58%, rgba(0, 0, 0, .55) 100%);
  animation: hk-roll 6s linear infinite;
}
@keyframes hk-roll { from { background-position: 0 -30%, 0 0; } to { background-position: 0 130%, 0 0; } }
.hk-crt.is-booted { animation: hk-flicker 5s steps(1, end) infinite; }
@keyframes hk-flicker { 0%, 100% { opacity: 1; } 47% { opacity: .96; } 48% { opacity: 1; } 82% { opacity: .98; } }

.hk-status { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: .5rem 1.5rem; margin-bottom: .8rem; font-size: .9rem; letter-spacing: .12em; }
.hk-status-line { color: var(--hk-orange); }
.hk-crt.is-danger .hk-status-line { color: #ff3b3b; text-shadow: 0 0 8px rgba(255, 59, 59, .7); animation: hk-blink .8s steps(1, end) infinite; }
@keyframes hk-blink { 50% { opacity: .25; } }
.hk-tries { display: flex; align-items: center; gap: .6rem; color: var(--hk-gray); text-shadow: none; }
.hk-tries-label { font-size: .78rem; letter-spacing: .14em; text-transform: uppercase; }
.hk-tries-boxes { display: inline-flex; gap: 6px; }
.hk-tries-boxes i { width: 14px; height: 18px; border: 1px solid var(--hk-orange); transition: background .25s, box-shadow .25s; }
.hk-tries-boxes i.is-on { background: var(--hk-orange); box-shadow: 0 0 10px var(--hk-glow); }
.hk-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.hk-screen { display: grid; grid-template-columns: minmax(0, auto) minmax(14rem, 1fr); gap: clamp(1rem, 2.5vw, 2rem); align-items: stretch; }

/* Grille de codes */
.hk-grid {
  display: flex; gap: clamp(1rem, 3vw, 2.2rem);
  font-size: clamp(.82rem, 1.55vw, 1.02rem); line-height: 1.55; letter-spacing: .14em;
  border-radius: 6px; outline: none;
}
.hk-grid:focus-visible { box-shadow: 0 0 0 1px rgba(255, 106, 0, .35); }
.hk-col { display: flex; flex-direction: column; }
.hk-line { display: flex; gap: .9rem; white-space: pre; }
.hk-crt.is-booted .hk-line { animation: hk-line-in .35s steps(4, end) both; animation-delay: calc(var(--i) * 22ms); }
@keyframes hk-line-in { from { opacity: 0; clip-path: inset(0 100% 0 0); } to { opacity: 1; clip-path: inset(0 0 0 0); } }
.hk-addr { color: var(--hk-gray-dim); text-shadow: none; letter-spacing: .06em; user-select: none; }
.hk-code { color: rgba(255, 106, 0, .78); }

.hk-tk { position: relative; cursor: pointer; border-radius: 2px; transition: background-color .08s, color .08s; }
.hk-word { color: var(--hk-orange-hi); }
.hk-bracket { color: rgba(255, 106, 0, .78); }
/* Survol souris : surlignage */
.hk-tk:hover:not(.is-off):not(.is-active) { background: rgba(255, 106, 0, .22); color: #fff; box-shadow: 0 0 0 1px rgba(255, 106, 0, .45); }
/* Sélection clavier : fond orange, texte noir */
.hk-tk.is-active { background: var(--hk-orange); color: #0A0A0A; text-shadow: none; box-shadow: 0 0 14px var(--hk-glow); }
.hk-tk.is-tried { color: var(--hk-gray-dim); text-decoration: line-through; text-decoration-color: rgba(255, 106, 0, .6); text-shadow: none; }
.hk-tk.is-tried.is-active { color: #0A0A0A; text-decoration-color: #0A0A0A; }
.hk-tk.is-off { color: #4a4a4a; cursor: default; text-shadow: none; }
.hk-tk.is-win { background: var(--hk-orange); color: #0A0A0A; animation: hk-win .5s steps(2, end) 3; }
@keyframes hk-win { 50% { background: transparent; color: var(--hk-orange); } }
.hk-tk.is-reveal { background: transparent; color: #fff; box-shadow: 0 0 0 1px #fff; text-shadow: 0 0 10px #fff; }

/* Journal à droite */
.hk-side { display: flex; flex-direction: column; min-height: 0; border-left: 1px dashed rgba(255, 106, 0, .22); padding-left: clamp(.8rem, 2vw, 1.4rem); }
.hk-log { flex: 1; min-height: 8rem; max-height: 21rem; overflow-y: auto; scrollbar-width: thin; scrollbar-color: #3a2410 transparent; font-size: .9rem; line-height: 1.55; }
.hk-log-line { word-break: break-word; }
.hk-log-line.is-muted { color: var(--hk-gray-dim); text-shadow: none; }
.hk-log-line.is-bad { color: var(--hk-gray); text-shadow: none; }
.hk-log-line.is-hot { color: #fff; text-shadow: 0 0 10px var(--hk-glow); }
.hk-log-line.is-good { color: var(--hk-orange-hi); text-shadow: 0 0 10px var(--hk-glow); }
.hk-prompt { margin-top: .6rem; font-size: 1.05rem; letter-spacing: .14em; color: #fff; }
.hk-prompt-text { margin-left: .35rem; }
.hk-caret { display: inline-block; width: .6em; height: 1.05em; margin-left: 2px; vertical-align: text-bottom; background: var(--hk-orange); box-shadow: 0 0 8px var(--hk-orange); animation: hk-blink 1s steps(1, end) infinite; }

/* Secousse sur erreur, extinction au verrouillage */
.hk-crt.is-shake { animation: hk-shake .32s linear; }
@keyframes hk-shake { 20% { transform: translateX(-5px); } 40% { transform: translateX(4px); } 60% { transform: translateX(-3px); } 80% { transform: translateX(2px); } }
.hk-crt.is-locked .hk-screen { filter: grayscale(1) brightness(.55); transition: filter .8s; }

/* Écran de fin (par-dessus la grille) */
.hk-result {
  position: absolute; inset: 0; z-index: 6;
  display: flex; overflow-y: auto; padding: clamp(1rem, 4vw, 2.5rem);
  background:
    repeating-linear-gradient(0deg, rgba(0, 0, 0, .3) 0 1px, transparent 1px 3px),
    radial-gradient(ellipse at center, rgba(40, 20, 4, .96) 0%, rgba(8, 5, 2, .97) 70%);
  color: var(--hk-orange); text-shadow: 0 0 4px var(--hk-glow);
  opacity: 0; transition: opacity .4s ease;
}
.hk-result[hidden] { display: none; }
.hk-result.is-in { opacity: 1; }
/* margin:auto = centré quand ça tient, défilable sinon (jamais coupé en haut) */
.hk-end { width: min(620px, 100%); margin: auto; text-align: center; }
.hk-end-tag { font-size: .74rem; letter-spacing: .16em; color: var(--hk-gray-dim); text-shadow: none; }
.hk-end-title {
  margin-top: .7rem; font-family: var(--hk-font); font-weight: 400;
  font-size: clamp(1.15rem, 3.2vw, 1.75rem); line-height: 1.3; letter-spacing: .06em; color: var(--hk-orange-hi);
  text-shadow: 0 0 6px var(--hk-glow), 0 0 26px rgba(255, 106, 0, .45);
}
.hk-result.is-in .hk-end-title { animation: hk-glitch .7s steps(1, end) both; }
@keyframes hk-glitch {
  0% { opacity: 0; transform: translateX(-8px); }
  15% { opacity: 1; transform: translateX(6px); filter: blur(1px); }
  30% { opacity: .4; transform: translateX(-3px) skewX(-8deg); }
  45% { opacity: 1; transform: translateX(2px); filter: none; }
  60% { opacity: .7; transform: none; }
  100% { opacity: 1; transform: none; }
}
.hk-end--lose .hk-end-title { color: #ff4b4b; text-shadow: 0 0 6px rgba(255, 59, 59, .6), 0 0 26px rgba(255, 59, 59, .35); }
/* Easter egg : logo KPS en ASCII + dossier classé */
.hk-ascii {
  margin: 1rem auto 0; width: max-content; max-width: 100%; overflow: hidden;
  /* Polices système qui contiennent les caractères « bloc » (alignement parfait) */
  font-family: Consolas, "Cascadia Mono", "DejaVu Sans Mono", Menlo, "Droid Sans Mono", "Courier New", monospace;
  font-size: clamp(.62rem, 2.6vw, 1rem); line-height: 1.05; letter-spacing: 0; white-space: pre; text-align: left;
  color: var(--hk-orange); text-shadow: 0 0 6px var(--hk-glow), 0 0 22px rgba(255, 106, 0, .35);
}
.hk-result.is-in .hk-ascii { animation: hk-ascii-in .9s steps(6, end) both; }
@keyframes hk-ascii-in { from { clip-path: inset(0 0 100% 0); } to { clip-path: inset(0 0 0 0); } }
.hk-ascii-sub { margin-top: .45rem; font-size: .72rem; letter-spacing: .42em; color: var(--hk-gray); text-shadow: none; }
.hk-classified {
  position: relative; margin: 1rem auto 0; max-width: 32rem; padding: 1.1rem 1.2rem 1rem;
  border: 1px dashed rgba(255, 106, 0, .5); border-radius: 4px; background: rgba(255, 106, 0, .05);
}
.hk-stamp {
  position: absolute; top: -.75rem; right: .9rem; padding: .1rem .55rem;
  border: 2px solid #ff3b3b; border-radius: 3px; background: #120806;
  font-size: .72rem; letter-spacing: .3em; text-transform: uppercase; color: #ff4b4b; text-shadow: none;
  transform: rotate(-6deg);
}
.hk-classified-text { color: #fff; font-size: clamp(.95rem, 2.4vw, 1.08rem); line-height: 1.55; letter-spacing: .03em; text-shadow: 0 0 10px rgba(255, 106, 0, .35); }
.hk-archive {
  margin: 1.2rem auto 0; padding: .9rem 1rem; max-width: 30rem;
  border: 1px dashed rgba(255, 106, 0, .4); border-radius: 4px;
  color: #fff; font-size: 1rem; line-height: 1.5;
}
.hk-archive span { display: block; margin-top: .35rem; font-size: .75rem; color: var(--hk-gray-dim); text-shadow: none; }
.hk-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: .5rem; margin-top: 1.1rem; }
.hk-stats div { padding: .55rem .4rem; border: 1px solid #2a2a2a; border-radius: 4px; background: rgba(255, 106, 0, .05); }
.hk-stats dt { font-size: .66rem; letter-spacing: .14em; text-transform: uppercase; color: var(--hk-gray-dim); text-shadow: none; }
.hk-stats dd { margin-top: .2rem; font-size: .95rem; color: #fff; }
.hk-record { margin-top: .8rem; font-size: .82rem; color: var(--hk-orange-hi); }
.hk-end-text { margin-top: .8rem; color: var(--hk-gray); text-shadow: none; line-height: 1.6; }
.hk-end-text strong { color: #fff; letter-spacing: .12em; }
.hk-end-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: .6rem; margin-top: 1.3rem; }
.hk-btn {
  display: inline-flex; align-items: center; justify-content: center;
  padding: .75rem 1.2rem; border-radius: 4px; cursor: pointer; text-decoration: none;
  font-family: var(--hk-font); font-size: .9rem; letter-spacing: .12em; text-transform: uppercase;
  color: var(--hk-orange); background: rgba(255, 106, 0, .08); border: 1px solid var(--hk-orange);
  text-shadow: 0 0 6px var(--hk-glow);
  transition: background .2s, color .2s, transform .2s;
}
.hk-btn:hover { background: var(--hk-orange); color: #0A0A0A; text-shadow: none; transform: translateY(-1px); }
.hk-btn--main { background: var(--hk-orange); color: #0A0A0A; text-shadow: none; box-shadow: 0 0 18px rgba(255, 106, 0, .4); }
.hk-btn--main:hover { background: var(--hk-orange-hi); }
.hk-btn--ghost { color: var(--hk-gray); border-color: #3A3A3A; background: transparent; text-shadow: none; }
.hk-btn--ghost:hover { background: #222; color: #fff; }

/* ---------- Accès caché dans le pied de page ---------- */
.hack-trigger {
  display: inline-flex; align-items: center; margin-left: .35rem; padding: 0 .2rem;
  background: none; border: 0; cursor: pointer;
  font-family: "Share Tech Mono", ui-monospace, monospace; font-size: .85em; color: #4a4a4a;
  transition: color .2s, text-shadow .2s;
}
.hack-trigger::after { content: ""; display: inline-block; width: .5em; height: .95em; margin-left: 1px; background: currentColor; animation: hk-blink 1.2s steps(1, end) infinite; }
.hack-trigger:hover, .hack-trigger:focus-visible { color: #FF6A00; text-shadow: 0 0 8px rgba(255, 106, 0, .6); outline: none; }
/* Au doigt : zone tactile de 44 px autour du petit curseur (sans changer son apparence) */
@media (max-width: 767px) { .hack-trigger { min-width: 44px; min-height: 44px; justify-content: center; margin: -14px 0 -14px .1rem; } }

/* ---------- Bloc « Teste tes compétences de hack » (section Rejoins le set) ---------- */
.hack-cta {
  position: relative; overflow: hidden;
  margin-top: .9rem; padding: 1.1rem;
  background: var(--color-surface, #1A1A1A);
  border: 1px solid rgba(255, 106, 0, .35); border-left: 3px solid #FF6A00; border-radius: 4px;
  box-shadow: 0 20px 40px -28px rgba(0, 0, 0, .9), 0 0 36px -24px rgba(255, 106, 0, .55);
}
.hack-cta-screen {
  position: relative; overflow: hidden;
  padding: .8rem .95rem; border-radius: 6px; border: 1px solid #262626;
  background: radial-gradient(ellipse at center, #140b04 0%, #0A0A0A 75%);
  font-family: "Share Tech Mono", ui-monospace, monospace; font-size: .86rem; line-height: 1.7;
  color: #FF8C00; text-shadow: 0 0 6px rgba(255, 106, 0, .5);
}
.hack-cta-screen::after {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background: repeating-linear-gradient(0deg, rgba(0, 0, 0, .3) 0 1px, transparent 1px 3px);
}
.hack-cta-screen span { color: #BDBDBD; text-shadow: none; }
.hack-cta-screen .is-dim { color: #8A8A8A; text-shadow: none; }
.hack-cta-caret { display: inline-block; width: .55em; height: 1em; vertical-align: text-bottom; background: #FF6A00; box-shadow: 0 0 8px #FF6A00; animation: hk-blink 1s steps(1, end) infinite; }
.hack-cta-text { margin-top: .9rem; color: var(--color-gray, #BDBDBD); line-height: 1.6; }
.hack-cta-btn { width: 100%; margin-top: 1rem; }
.hack-cta-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }

/* ---------- Petits écrans ---------- */
@media (max-width: 820px) {
  .hk-screen { grid-template-columns: minmax(0, 1fr); }
  .hk-side { border-left: 0; border-top: 1px dashed rgba(255, 106, 0, .22); padding: .8rem 0 0; }
  .hk-log { min-height: 5.5rem; max-height: 8rem; }
  .hk-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 560px) {
  .hk-grid { flex-direction: column; align-items: center; gap: 0; font-size: .92rem; letter-spacing: .1em; }
  .hk-help { display: none; }
  .hk-line { gap: .7rem; }
}

/* ---------- Téléphone (< 768 px) : plein écran, gros doigts, effets allégés ---------- */
@media (max-width: 767px) {
  .hk-overlay { padding: 0; }
  .hk-modal { width: 100%; height: 100%; max-height: 100%; border-radius: 0; border-left: 0; border-right: 0; box-shadow: none; }
  .hk-icon { width: 44px; height: 44px; } /* fermer / son : faciles à toucher */
  .hk-body { padding: .9rem .85rem 1.25rem; }
  .hk-kicker { font-size: .66rem; letter-spacing: .2em; }
  .hk-title { font-size: clamp(1.2rem, 6vw, 1.5rem); text-shadow: none; }
  .hk-rules { font-size: .82rem; line-height: 1.5; }

  /* Écran CRT allégé : pas de barre de balayage animée ni de scintillement, halo plus léger */
  .hk-crt { overflow: visible; padding: .75rem; border-radius: 10px; text-shadow: 0 0 3px rgba(255, 106, 0, .45); }
  .hk-crt::after, .hk-crt.is-booted { animation: none; }
  .hk-crt::after { display: none; }
  .hk-crt.is-booted .hk-line { animation-duration: .2s; animation-delay: calc(var(--i) * 12ms); }

  /* Le journal (résultat de chaque essai) reste collé en haut pendant qu'on fait défiler la grille */
  .hk-screen { display: flex; flex-direction: column; gap: .6rem; }
  .hk-side {
    order: -1; position: sticky; top: -1px; z-index: 4;
    margin: 0 -.75rem; padding: .55rem .75rem;
    border-left: 0; border-bottom: 1px dashed rgba(255, 106, 0, .3);
    background: #0d0804; box-shadow: 0 8px 14px -10px #000;
  }
  .hk-log { min-height: 3.3rem; max-height: 5rem; font-size: .82rem; line-height: 1.45; }
  .hk-prompt { margin-top: .3rem; font-size: .95rem; }

  /* Grille centrée, lignes hautes : chaque mot se touche facilement au doigt */
  .hk-grid { justify-content: center; }
  .hk-line { justify-content: center; line-height: 2.6; }
  .hk-tk { padding: .6rem .1rem; }
  .hk-tk.is-active { box-shadow: none; }

  .hk-end-actions { flex-direction: column; }
  .hk-btn { width: 100%; min-height: 48px; }
  .hk-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (prefers-reduced-motion: reduce) {
  .hk-crt::after, .hk-crt.is-booted, .hk-caret, .hack-trigger::after, .hack-cta-caret, .hk-ascii { animation: none !important; }
  .hk-crt.is-booted .hk-line, .hk-result.is-in .hk-end-title { animation: none !important; }
}
