/* Higher or Lower Hall engine */
.qt-eng-hilo { container-type: inline-size; }

.qt-hilo {
  --qt-hilo-glow: color-mix(in srgb, var(--qt-accent, #ff5f7a) 50%, transparent);
  --qt-hilo-red: #e0233f;
  --qt-hilo-black: #1d1530;
  display: grid;
  gap: 14px;
  width: 100%;
  max-width: 980px;
  margin: 0 auto;
  color: var(--qt-ink, #f6f1ff);
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
}
@container (min-width: 780px) {
  .qt-hilo { grid-template-columns: minmax(0, 1fr) 300px; gap: 22px; }
}

.qt-hilo-play { display: grid; gap: 10px; justify-items: center; min-width: 0; }

.qt-hilo-felt {
  position: relative;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: clamp(10px, 3vw, 28px);
  width: 100%;
  padding: clamp(16px, 3.5vw, 30px) clamp(12px, 3vw, 28px);
  border-radius: calc(var(--qt-r, 16px) + 10px);
  background:
    radial-gradient(90% 80% at 50% 40%, #1f6b4a, #0f3d2a 70%, #0a2a1d);
  border: 3px solid #c99a3d;
  box-shadow: 0 22px 50px rgba(0, 0, 0, .55), 0 0 0 6px rgba(60, 20, 10, .85), 0 0 40px var(--qt-hilo-glow), inset 0 0 40px rgba(0, 0, 0, .45);
}

.qt-hilo-deck { position: relative; justify-self: end; width: clamp(56px, 13vw, 92px); aspect-ratio: 5 / 7; }
.qt-hilo-deck .qt-hilo-card { position: absolute; inset: 0; }
.qt-hilo-deck .qt-hilo-card:nth-child(1) { transform: translate(-6px, 6px) rotate(-4deg); }
.qt-hilo-deck .qt-hilo-card:nth-child(2) { transform: translate(-3px, 3px) rotate(-2deg); }
.qt-hilo-deck .qt-hilo-card .qt-hilo-card-inner { transform: rotateY(180deg); }

.qt-hilo-slot { display: grid; width: clamp(128px, 32vw, 196px); }
.qt-hilo-slot > .qt-hilo-card { grid-area: 1 / 1; }

/* card */
.qt-hilo-card { perspective: 900px; aspect-ratio: 5 / 7; width: 100%; }
.qt-hilo-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform .4s cubic-bezier(.2, .8, .25, 1);
}
.qt-hilo-card.is-back .qt-hilo-card-inner { transform: rotateY(180deg); transition: none; }
.qt-hilo-face {
  position: absolute;
  inset: 0;
  border-radius: 9%/6.5%;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  box-shadow: 0 10px 22px rgba(0, 0, 0, .45);
}
.qt-hilo-face--back {
  transform: rotateY(180deg);
  display: grid;
  place-items: center;
  background:
    repeating-linear-gradient(45deg, rgba(255, 255, 255, .12) 0 4px, transparent 4px 10px),
    repeating-linear-gradient(-45deg, rgba(255, 255, 255, .12) 0 4px, transparent 4px 10px),
    linear-gradient(160deg, color-mix(in srgb, var(--qt-accent, #ff5f7a) 80%, #fff), var(--qt-accent, #ff5f7a) 50%, color-mix(in srgb, var(--qt-accent, #ff5f7a) 55%, #000));
  border: 3px solid #fff;
}
.qt-hilo-back-mark {
  width: 42%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 3px solid rgba(255, 255, 255, .8);
  background: radial-gradient(circle, rgba(255, 255, 255, .35), transparent 70%);
}
.qt-hilo-face--front {
  background: linear-gradient(160deg, #ffffff, #f4efe6);
  border: 1px solid rgba(0, 0, 0, .15);
  color: var(--qt-hilo-black);
  fill: currentColor;
  container-type: inline-size;
}
.qt-hilo-face--front.is-red { color: var(--qt-hilo-red); }
.qt-hilo-corner { position: absolute; display: grid; justify-items: center; line-height: 1; }
.qt-hilo-corner--tl { left: 7%; top: 5%; }
.qt-hilo-corner--br { right: 7%; bottom: 5%; transform: rotate(180deg); }
.qt-hilo-corner-r { font-size: 16cqw; font-weight: 900; letter-spacing: -.04em; }
.qt-hilo-corner-s { width: 11cqw; height: 11cqw; margin-top: 2cqw; }
.qt-hilo-mid { position: absolute; inset: 0; display: grid; place-items: center; align-content: center; gap: 2cqw; }
.qt-hilo-mid-r { font-size: 40cqw; font-weight: 950; line-height: .9; letter-spacing: -.05em; }
.qt-hilo-mid-s { width: 30cqw; height: 30cqw; }

.qt-hilo.is-shake .qt-hilo-slot { animation: qt-hilo-shake .4s ease-out; }
@keyframes qt-hilo-shake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-8px) rotate(-2deg); }
  50% { transform: translateX(7px) rotate(2deg); }
  75% { transform: translateX(-4px); }
}

.qt-hilo-meter { justify-self: start; display: grid; gap: 2px; min-width: 0; }
.qt-hilo-meter-l { font-size: 11px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; color: rgba(255, 255, 255, .7); }
.qt-hilo-meter-v {
  font-size: clamp(24px, 5vw, 40px);
  font-weight: 950;
  line-height: 1;
  color: var(--qt-gold, #ffcf4a);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 3px 0 rgba(0, 0, 0, .35), 0 0 18px rgba(255, 207, 74, .35);
}
.qt-hilo-meter-v.is-bump { animation: qt-hilo-bump .3s ease-out; }
@keyframes qt-hilo-bump { from { transform: scale(.95); } 55% { transform: scale(1.12); } to { transform: scale(1); } }
.qt-hilo-meter-s { font-size: 12px; color: rgba(255, 255, 255, .7); font-variant-numeric: tabular-nums; }

.qt-hilo-msg {
  min-height: 40px;
  padding: 9px 18px;
  border-radius: 999px;
  background: var(--qt-panel, rgba(18, 12, 38, .72));
  border: 1px solid var(--qt-line, rgba(255, 255, 255, .12));
  backdrop-filter: blur(8px);
  font-weight: 800;
  text-align: center;
}
.qt-hilo.is-win .qt-hilo-msg { color: var(--qt-ember, #ffa63d); border-color: rgba(255, 166, 61, .5); box-shadow: 0 0 24px rgba(255, 166, 61, .3); }
.qt-hilo.is-lose .qt-hilo-msg { color: #ff9aa9; }

.qt-hilo-hist { display: flex; gap: 6px; margin: 0; padding: 0 0 14px; list-style: none; min-height: 74px; max-width: 100%; overflow: hidden; }
.qt-hilo-hitem { position: relative; flex: none; width: 40px; animation: qt-hilo-in .25s ease-out; }
.qt-hilo-card--mini .qt-hilo-corner { display: none; }
.qt-hilo-card--mini .qt-hilo-face { box-shadow: 0 4px 8px rgba(0, 0, 0, .4); border-radius: 6px; }
.qt-hilo-hitem::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -9px;
  margin-left: -5px;
  border: 5px solid transparent;
}
.qt-hilo-hitem.is-up::after { border-bottom-color: var(--qt-ember, #ffa63d); bottom: -10px; }
.qt-hilo-hitem.is-down::after { border-top-color: var(--qt-ember, #ffa63d); bottom: -12px; }
.qt-hilo-hitem.is-miss .qt-hilo-face--front { box-shadow: 0 0 0 2px #ff4f6a, 0 4px 8px rgba(0, 0, 0, .4); }
@keyframes qt-hilo-in { from { transform: scale(.95); opacity: 0; } to { transform: scale(1); } }

/* panel */
.qt-hilo-panel {
  display: grid;
  gap: 12px;
  padding: 14px;
  border-radius: var(--qt-r, 16px);
  background: linear-gradient(180deg, rgba(56, 18, 34, .86), rgba(22, 8, 18, .92));
  border: 1px solid var(--qt-line, rgba(255, 255, 255, .12));
  box-shadow: 0 20px 50px rgba(0, 0, 0, .45), inset 0 1px 0 rgba(255, 255, 255, .08);
  backdrop-filter: blur(10px);
}
.qt-hilo-calls { display: grid; grid-template-columns: 1fr; gap: 8px; }
.qt-hilo-call {
  display: flex;
  align-items: center;
  gap: 12px;
  min-height: 62px;
  padding: 8px 14px;
  border: 0;
  border-radius: 16px;
  font: inherit;
  text-align: left;
  color: #fff;
  cursor: pointer;
  transition: transform .12s ease-out, opacity .2s ease-out;
}
.qt-hilo-call--up {
  background: linear-gradient(180deg, #3ff09a, #17b864 60%, #0e8a48);
  box-shadow: 0 4px 0 #075c2f, 0 8px 20px rgba(23, 184, 100, .3), inset 0 2px 0 rgba(255, 255, 255, .45);
}
.qt-hilo-call--down {
  background: linear-gradient(180deg, #ff8095, #f0405f 60%, #b81f3c);
  box-shadow: 0 4px 0 #7a0f24, 0 8px 20px rgba(240, 64, 95, .3), inset 0 2px 0 rgba(255, 255, 255, .45);
}
.qt-hilo-call:hover { transform: translateY(-1px); }
.qt-hilo-call:active { transform: translateY(3px); }
.qt-hilo-call:disabled { cursor: default; opacity: .4; transform: none; filter: saturate(.4); }
.qt-hilo-call:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.qt-hilo-arrow {
  flex: none;
  width: 0;
  height: 0;
  border-left: 12px solid transparent;
  border-right: 12px solid transparent;
}
.qt-hilo-call--up .qt-hilo-arrow { border-bottom: 16px solid #fff; }
.qt-hilo-call--down .qt-hilo-arrow { border-top: 16px solid #fff; }
.qt-hilo-call-txt { display: grid; gap: 1px; }
.qt-hilo-call-main { font-size: 19px; font-weight: 950; letter-spacing: .03em; text-transform: uppercase; text-shadow: 0 2px 0 rgba(0, 0, 0, .2); }
.qt-hilo-call-sub { font-size: 12.5px; font-weight: 700; opacity: .9; font-variant-numeric: tabular-nums; }

.qt-hilo-go {
  display: grid;
  justify-items: center;
  gap: 1px;
  width: 100%;
  min-height: 60px;
  padding: 8px 14px;
  border: 0;
  border-radius: 999px;
  font: inherit;
  color: #2a1200;
  cursor: pointer;
  background: linear-gradient(180deg, #ffd9a0 0%, var(--qt-ember, #ffa63d) 45%, #e07a1f 100%);
  box-shadow: 0 5px 0 #8a3d00, 0 10px 28px rgba(255, 166, 61, .35), inset 0 2px 0 rgba(255, 255, 255, .7);
  transition: transform .1s ease-out, opacity .2s ease-out;
}
.qt-hilo.is-live .qt-hilo-go:not(:disabled) {
  color: #2a1700;
  background: linear-gradient(180deg, #fff1a8 0%, var(--qt-gold, #ffcf4a) 45%, #e09a00 100%);
  box-shadow: 0 5px 0 #8a5a00, 0 10px 28px rgba(255, 207, 74, .4), inset 0 2px 0 rgba(255, 255, 255, .7);
}
.qt-hilo-go-main { font-size: 19px; font-weight: 950; letter-spacing: .04em; text-transform: uppercase; }
.qt-hilo-go-sub { font-size: 12px; font-weight: 700; opacity: .75; }
.qt-hilo-go:hover { transform: translateY(-1px); }
.qt-hilo-go:active { transform: translateY(4px); }
.qt-hilo-go:disabled { cursor: default; opacity: .55; transform: none; }
.qt-hilo-go:focus-visible { outline: 3px solid #fff; outline-offset: 3px; }
.qt-hilo-note { margin: 0; font-size: 12px; line-height: 1.45; color: var(--qt-muted, #b9b0d6); text-align: center; }

@container (max-width: 779px) {
  .qt-hilo-panel { padding: 12px; gap: 10px; }
  .qt-hilo-calls { grid-template-columns: 1fr 1fr; }
  .qt-hilo-call { min-height: 58px; padding: 8px 10px; gap: 8px; }
  .qt-hilo-call-main { font-size: 16px; }
  .qt-hilo-call-sub { font-size: 11px; }
  .qt-hilo-felt { grid-template-columns: auto auto; grid-template-areas: "deck card" "meter meter"; justify-content: center; }
  .qt-hilo-deck { grid-area: deck; }
  .qt-hilo-slot { grid-area: card; }
  .qt-hilo-meter { grid-area: meter; justify-self: center; justify-items: center; grid-template-columns: auto auto auto; align-items: baseline; gap: 8px; }
  .qt-hilo-hist { min-height: 70px; }
  .qt-hilo-hitem { width: 34px; }
}

@media (prefers-reduced-motion: reduce) {
  .qt-hilo-card-inner { transition: none; }
  .qt-hilo.is-shake .qt-hilo-slot, .qt-hilo-meter-v.is-bump, .qt-hilo-hitem { animation: none; }
}
