/* =========================================================
   LE REFUGE VIRTUEL — HI-LO
   Solo contre Vulpy + Multijoueur
   ========================================================= */

#highlow-shell {
  width: min(920px, 94vw);
  max-height: 88vh;
  overflow-y: auto;
  box-sizing: border-box;
  color: #f5f5f5;
  font-family: inherit;
}

.hl-dialog-wrap {
  position: relative;
  padding: 22px;
  box-sizing: border-box;
  background:
    radial-gradient(circle at 50% 0%, rgba(212, 175, 55, .13), transparent 42%),
    linear-gradient(145deg, #171717, #090909 70%);
  border: 1px solid rgba(212, 175, 55, .42);
  border-radius: 22px;
  box-shadow: 0 25px 80px rgba(0, 0, 0, .7);
}

.hl-close {
  position: absolute;
  z-index: 20;
  top: 10px;
  right: 14px;
  width: 40px;
  height: 40px;
  border: 0;
  border-radius: 50%;
  background: rgba(255,255,255,.08);
  color: #fff;
  font-size: 28px;
  line-height: 1;
  cursor: pointer;
}

.hl-close:hover {
  background: rgba(255,255,255,.16);
}

.hl-back {
  border: 0;
  background: transparent;
  color: #d9b95f;
  font-weight: 700;
  cursor: pointer;
  padding: 7px 3px 15px;
}

.hl-back:hover {
  color: #ffe39a;
}

.hl-home {
  padding: 15px 5px 8px;
}

.hl-hero {
  display: flex;
  align-items: center;
  gap: 18px;
  margin-bottom: 26px;
}

.hl-logo {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  width: 76px;
  height: 76px;
  border-radius: 22px;
  background:
    linear-gradient(145deg, #f2d675, #a77a16);
  color: #111;
  font-size: 42px;
  font-weight: 900;
  box-shadow:
    0 10px 35px rgba(212,175,55,.25),
    inset 0 1px 1px rgba(255,255,255,.6);
}

.hl-hero h2 {
  margin: 0 0 5px;
  font-size: 30px;
  color: #f4d878;
}

.hl-hero p {
  margin: 0;
  color: #bbb;
  line-height: 1.5;
}

.hl-mode-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
}

.hl-mode-card {
  min-height: 190px;
  padding: 22px;
  border: 1px solid rgba(212,175,55,.25);
  border-radius: 20px;
  background:
    linear-gradient(145deg, rgba(255,255,255,.06), rgba(255,255,255,.015));
  color: #fff;
  text-align: left;
  cursor: pointer;
  transition:
    transform .2s ease,
    border-color .2s ease,
    box-shadow .2s ease;
}

.hl-mode-card:hover {
  transform: translateY(-3px);
  border-color: rgba(230,195,91,.7);
  box-shadow: 0 15px 35px rgba(0,0,0,.35);
}

.hl-mode-card strong {
  display: block;
  margin: 10px 0 8px;
  font-size: 20px;
  color: #f1d57a;
}

.hl-mode-card small {
  display: block;
  color: #aaa;
  line-height: 1.55;
  font-size: 14px;
}

.hl-mode-icon {
  display: block;
  font-size: 36px;
}

.hl-rules-short {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.hl-rules-short span {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255,255,255,.055);
  color: #aaa;
  font-size: 12px;
}

.hl-panel {
  padding: 22px;
  border: 1px solid rgba(212,175,55,.2);
  border-radius: 20px;
  background: rgba(255,255,255,.025);
}

.hl-panel-title,
.hl-game-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  margin-bottom: 22px;
}

.hl-panel-title {
  justify-content: flex-start;
}

.hl-panel-title > span {
  font-size: 35px;
}

.hl-panel h3,
.hl-game-header h3 {
  margin: 0;
  color: #f3d778;
  font-size: 23px;
}

.hl-panel-title p {
  margin: 5px 0 0;
  color: #999;
}

.hl-mode-badge {
  display: inline-block;
  margin-bottom: 5px;
  color: #c9a846;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: .12em;
}

.hl-create-form {
  display: grid;
  gap: 15px;
}

.hl-create-form label {
  color: #ddd;
  font-weight: 700;
}

.hl-stake-input {
  display: flex;
  align-items: center;
  margin-top: 8px;
  border: 1px solid rgba(212,175,55,.28);
  border-radius: 14px;
  overflow: hidden;
  background: #101010;
}

.hl-stake-input input {
  flex: 1;
  min-width: 0;
  padding: 14px;
  border: 0;
  outline: 0;
  background: transparent;
  color: #fff;
  font-size: 18px;
  font-weight: 800;
}

.hl-stake-input span {
  padding: 0 15px;
  color: #d5b95f;
  font-size: 13px;
}

.hl-quick-stakes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.hl-quick-stakes button {
  padding: 8px 13px;
  border: 1px solid rgba(212,175,55,.2);
  border-radius: 10px;
  background: rgba(255,255,255,.04);
  color: #ddd;
  cursor: pointer;
}

.hl-quick-stakes button:hover {
  border-color: #d6b650;
  color: #f4d978;
}

.hl-primary,
.hl-secondary,
.hl-danger,
.hl-cashout {
  border: 0;
  border-radius: 13px;
  padding: 13px 17px;
  font: inherit;
  font-weight: 800;
  cursor: pointer;
  transition: transform .15s ease, filter .15s ease;
}

.hl-primary {
  background: linear-gradient(135deg, #f0d06b, #a77b17);
  color: #111;
}

.hl-secondary {
  background: rgba(255,255,255,.08);
  color: #eee;
  border: 1px solid rgba(255,255,255,.12);
}

.hl-danger {
  background: rgba(187,45,45,.16);
  color: #ff9a9a;
  border: 1px solid rgba(255,84,84,.25);
}

.hl-cashout {
  width: min(420px, 100%);
  margin-top: 18px;
  background: linear-gradient(135deg, #e9c95e, #9d7317);
  color: #111;
}

.hl-primary:hover,
.hl-secondary:hover,
.hl-danger:hover,
.hl-cashout:hover {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.hl-primary:disabled,
.hl-secondary:disabled,
.hl-choice:disabled {
  opacity: .55;
  cursor: not-allowed;
  transform: none;
}

.hl-stake-badge {
  padding: 9px 13px;
  border-radius: 12px;
  background: rgba(212,175,55,.11);
  color: #f2d678;
  font-weight: 800;
}

.hl-solo-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 20px;
}

.hl-solo-stats > div {
  padding: 13px;
  border-radius: 14px;
  background: rgba(255,255,255,.04);
  text-align: center;
}

.hl-solo-stats small {
  display: block;
  margin-bottom: 4px;
  color: #888;
}

.hl-solo-stats strong {
  color: #f1d26c;
  font-size: 20px;
}

.hl-table {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 24px 12px;
  border-radius: 20px;
  background:
    radial-gradient(circle at center, rgba(26,98,60,.28), rgba(4,30,19,.15) 55%, rgba(0,0,0,.15)),
    linear-gradient(145deg, rgba(255,255,255,.025), rgba(255,255,255,.01));
  border: 1px solid rgba(255,255,255,.06);
}

.hl-current-label {
  margin-bottom: 12px;
  color: #aaa;
  font-size: 13px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
}

.hl-card {
  position: relative;
  display: grid;
  place-items: center;
  width: 128px;
  height: 178px;
  border-radius: 13px;
  background:
    linear-gradient(145deg, #fff, #e9e9e9);
  color: #171717;
  box-shadow:
    0 16px 35px rgba(0,0,0,.45),
    inset 0 0 0 1px rgba(0,0,0,.08);
  animation: hlCardIn .3s ease;
}

.hl-card-top,
.hl-card-bottom {
  position: absolute;
  font-size: 23px;
  font-weight: 900;
}

.hl-card-top {
  top: 10px;
  left: 12px;
}

.hl-card-bottom {
  right: 12px;
  bottom: 10px;
  transform: rotate(180deg);
}

.hl-card-center {
  font-size: 49px;
  font-weight: 900;
}

.hl-card-back {
  overflow: hidden;
  background:
    repeating-linear-gradient(
      45deg,
      #1b1b1b 0,
      #1b1b1b 8px,
      #b99432 8px,
      #b99432 10px
    );
  color: #f1d26b;
  border: 4px solid #e7ca68;
}

.hl-card-back span {
  display: grid;
  place-items: center;
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: #111;
  font-size: 30px;
  font-weight: 900;
}

.hl-question {
  margin: 20px 0 13px;
  color: #eee;
  font-size: 17px;
  font-weight: 800;
}

.hl-choice-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(140px, 210px));
  gap: 12px;
  width: 100%;
  justify-content: center;
}

.hl-choice {
  min-height: 90px;
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,.09);
  color: #fff;
  cursor: pointer;
  transition: transform .18s ease, filter .18s ease;
}

.hl-choice span {
  display: block;
  margin-bottom: 5px;
  font-size: 27px;
}

.hl-choice strong {
  font-size: 13px;
}

.hl-higher {
  background: linear-gradient(145deg, rgba(35,135,77,.8), rgba(17,72,44,.9));
}

.hl-lower {
  background: linear-gradient(145deg, rgba(163,57,57,.8), rgba(89,28,28,.9));
}

.hl-choice:hover {
  transform: translateY(-2px);
  filter: brightness(1.12);
}

.hl-first-win {
  margin: 16px 0 0;
  color: #888;
  font-size: 12px;
}

.hl-reveal {
  text-align: center;
}

.hl-result-title {
  margin: 5px 0 22px;
  color: #f0d16b;
  font-size: 25px;
  font-weight: 900;
}

.hl-reveal-cards {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 22px;
}

.hl-reveal-cards > div:not(.hl-arrow) {
  display: grid;
  justify-items: center;
  gap: 8px;
}

.hl-reveal-cards small {
  color: #888;
}

.hl-arrow {
  color: #d3b34d;
  font-size: 32px;
}

.hl-card-old {
  opacity: .65;
  transform: scale(.9);
}

.hl-card-new {
  animation: hlFlip .5s ease;
}

.hl-result-stats {
  margin: 20px 0 15px;
  color: #bbb;
}

.hl-lost {
  margin: 20px 0;
  color: #ff9b9b;
}

.hl-scoreboard {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  margin-bottom: 15px;
}

.hl-scoreboard > div:not(.hl-score-target) {
  padding: 14px;
  border-radius: 14px;
  background: rgba(255,255,255,.04);
  text-align: center;
}

.hl-scoreboard small {
  display: block;
  color: #888;
}

.hl-scoreboard strong {
  display: block;
  margin-top: 3px;
  color: #f1d36e;
  font-size: 28px;
}

.hl-score-target {
  color: #8d8d8d;
  font-size: 12px;
  font-weight: 800;
}

.hl-round {
  margin-bottom: 12px;
  text-align: center;
  color: #c5a747;
  font-weight: 800;
}

.hl-secret-choice {
  display: grid;
  gap: 8px;
  margin-top: 20px;
  padding: 15px 20px;
  border: 1px solid rgba(212,175,55,.18);
  border-radius: 14px;
  background: rgba(0,0,0,.22);
  text-align: center;
}

.hl-secret-choice strong {
  color: #f0d16b;
}

.hl-secret-choice span {
  color: #999;
  font-size: 13px;
}

.hl-lobby-title {
  margin: 25px 0 10px;
  color: #d8b951;
  font-weight: 900;
}

.hl-lobby-list {
  display: grid;
  gap: 9px;
}

.hl-lobby-game {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px;
  border: 1px solid rgba(255,255,255,.07);
  border-radius: 14px;
  background: rgba(255,255,255,.025);
}

.hl-lobby-game strong,
.hl-lobby-game small {
  display: block;
}

.hl-lobby-game small {
  margin-top: 3px;
  color: #888;
}

.hl-empty {
  padding: 25px;
  border: 1px dashed rgba(212,175,55,.18);
  border-radius: 14px;
  color: #888;
  text-align: center;
  line-height: 1.6;
}

.hl-waiting,
.hl-finished,
.hl-error {
  text-align: center;
}

.hl-wait-icon,
.hl-finish-icon {
  margin-bottom: 10px;
  font-size: 55px;
}

.hl-wait-stake,
.hl-wait-pot {
  margin: 7px 0;
  color: #aaa;
}

.hl-wait-stake strong,
.hl-wait-pot strong {
  color: #f0d16b;
}

.hl-pulse {
  margin: 22px auto;
  color: #c9a846;
  animation: hlPulse 1.3s ease-in-out infinite;
}

.hl-final-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 15px;
  margin: 18px 0;
  font-size: 32px;
}

.hl-final-score strong {
  color: #f0d16b;
  font-size: 42px;
}

.hl-big-win {
  margin: 17px 0;
  color: #f1d16a;
  font-size: 35px;
  font-weight: 900;
}

.hl-big-win small {
  display: block;
  margin-top: 4px;
  color: #888;
  font-size: 12px;
  font-weight: 600;
}

.hl-finished .hl-primary,
.hl-finished .hl-secondary {
  margin: 5px;
}

.hl-loading {
  display: grid;
  place-items: center;
  min-height: 280px;
  color: #d5b752;
  font-weight: 800;
  animation: hlPulse 1.2s ease-in-out infinite;
}

.hl-error > div {
  font-size: 45px;
}

.hl-error p {
  color: #aaa;
}

@keyframes hlCardIn {
  from {
    opacity: 0;
    transform: translateY(10px) scale(.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

@keyframes hlFlip {
  0% {
    opacity: 0;
    transform: rotateY(90deg) scale(.9);
  }
  100% {
    opacity: 1;
    transform: rotateY(0) scale(1);
  }
}

@keyframes hlPulse {
  0%, 100% {
    opacity: .55;
  }
  50% {
    opacity: 1;
  }
}

@media (max-width: 700px) {
  .hl-dialog-wrap {
    padding: 17px 12px;
    border-radius: 17px;
  }

  #highlow-shell {
    width: min(96vw, 920px);
    max-height: 90vh;
  }

  .hl-hero {
    padding-right: 30px;
  }

  .hl-logo {
    width: 60px;
    height: 60px;
    font-size: 34px;
  }

  .hl-hero h2 {
    font-size: 24px;
  }

  .hl-mode-grid {
    grid-template-columns: 1fr;
  }

  .hl-mode-card {
    min-height: 145px;
  }

  .hl-panel {
    padding: 16px 11px;
  }

  .hl-game-header {
    align-items: flex-start;
    flex-direction: column;
  }

  .hl-solo-stats {
    grid-template-columns: repeat(3, 1fr);
    gap: 5px;
  }

  .hl-solo-stats > div {
    padding: 9px 4px;
  }

  .hl-solo-stats small {
    font-size: 10px;
  }

  .hl-solo-stats strong {
    font-size: 16px;
  }

  .hl-card {
    width: 105px;
    height: 148px;
  }

  .hl-card-center {
    font-size: 39px;
  }

  .hl-choice-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .hl-choice {
    min-height: 80px;
  }

  .hl-reveal-cards {
    gap: 9px;
  }

  .hl-reveal-cards .hl-card {
    width: 90px;
    height: 126px;
  }

  .hl-arrow {
    font-size: 22px;
  }

  .hl-scoreboard {
    gap: 5px;
  }

  .hl-scoreboard > div:not(.hl-score-target) {
    padding: 10px 5px;
  }

  .hl-score-target {
    max-width: 55px;
    text-align: center;
  }

  .hl-lobby-game {
    align-items: stretch;
    flex-direction: column;
  }

  .hl-lobby-game button {
    width: 100%;
  }
}


/* === CORRECTIF FINAL FENETRE HI-LO === */

#dialog:has(#highlow-shell) {
  width: min(960px, calc(100vw - 40px)) !important;
  max-width: 960px !important;
  max-height: calc(100vh - 40px) !important;
  margin: auto !important;
  padding: 0 !important;
  overflow-x: hidden !important;
  overflow-y: auto !important;
  box-sizing: border-box !important;
}

#dialog:has(#highlow-shell) #dialog-body {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
}

#highlow-shell {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
  margin: 0 !important;
  padding: 28px !important;
  overflow-x: hidden !important;
  box-sizing: border-box !important;
}

#highlow-shell *,
#highlow-shell *::before,
#highlow-shell *::after {
  box-sizing: border-box !important;
}

#highlow-shell .hl-mode-grid,
#highlow-shell .hl-choice-grid,
#highlow-shell .hl-lobby-list {
  width: 100% !important;
  max-width: 100% !important;
  min-width: 0 !important;
}

#highlow-shell .hl-mode-card,
#highlow-shell .hl-panel,
#highlow-shell .hl-lobby-game {
  min-width: 0 !important;
  max-width: 100% !important;
}

#dialog:has(#highlow-shell) #close-dialog {
  position: absolute !important;
  top: 12px !important;
  right: 12px !important;
  left: auto !important;
  z-index: 50 !important;
}

@media (max-width: 700px) {
  #dialog:has(#highlow-shell) {
    width: calc(100vw - 16px) !important;
    max-width: calc(100vw - 16px) !important;
    max-height: calc(100vh - 16px) !important;
  }

  #highlow-shell {
    padding: 20px 14px !important;
  }

  #highlow-shell .hl-mode-grid,
  #highlow-shell .hl-choice-grid {
    grid-template-columns: 1fr !important;
  }
}
