/* Premium Recent Results HUD. Scoped to gameplay to preserve home history. */

.device.is-playing .history {
  --hist-pad-x: clamp(14px, 1.1vw, 20px);
  --hist-pad-y: clamp(14px, 1.5vh, 20px);
  width: min(100%, clamp(280px, 17vw, 330px));
  height: min(calc(100% - 8px), clamp(480px, 68vh, 650px));
  max-height: calc(100% - 8px);
  aspect-ratio: auto;
  overflow: hidden;
  border: 1px solid rgba(220, 174, 74, 0.45);
  border-radius: 14px;
  background: linear-gradient(180deg, rgba(24, 14, 8, 0.9), rgba(12, 8, 5, 0.82));
  box-shadow:
    0 16px 42px rgba(0, 0, 0, 0.38),
    inset 0 1px 0 rgba(255, 226, 155, 0.08);
  backdrop-filter: blur(8px);
  isolation: isolate;
}

.device.is-playing .history > .panel-frame-img {
  display: none;
}

.device.is-playing .hist-inner {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: var(--hist-pad-y) var(--hist-pad-x);
  gap: clamp(7px, 0.8vh, 10px);
  overflow: hidden;
  border: 0;
  border-radius: inherit;
  background: transparent;
  box-shadow: none;
  backdrop-filter: none;
}

.device.is-playing .hist-title {
  flex: 0 0 auto;
  display: grid;
  place-items: center;
  min-height: clamp(26px, 3.5vh, 34px);
  padding: 0 4px clamp(6px, 0.7vh, 9px);
  color: #f6d785;
  font-size: clamp(0.75rem, 1.55vh, 0.98rem);
  line-height: 1.15;
  letter-spacing: 0;
  text-shadow: 0 2px 5px rgba(0, 0, 0, 0.75);
  border-bottom: 1px solid rgba(222, 174, 67, 0.28);
}

.device.is-playing .hist-list {
  flex: 1 1 auto;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
  overflow: hidden;
}

.device.is-playing .history-slot {
  flex: 1 1 0;
  min-height: 0;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  grid-template-rows: 1fr;
  align-items: center;
  gap: clamp(8px, 0.75vw, 12px);
  padding: clamp(5px, 0.65vh, 8px) clamp(4px, 0.45vw, 7px);
  border-bottom: 1px solid rgba(218, 168, 60, 0.18);
  background: transparent;
}

.device.is-playing .history-slot:last-child {
  border-bottom: 0;
}

.device.is-playing .history-slot .hist-row {
  grid-column: 1;
  grid-row: 1;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: clamp(9px, 0.75vw, 13px);
}

.device.is-playing .history-slot .hist-die {
  flex: 0 0 auto;
  width: clamp(36px, 4.6vh, 48px);
  height: clamp(36px, 4.6vh, 48px);
  object-fit: contain;
  object-position: center;
}

.device.is-playing .history-slot .hist-num {
  color: #f8d87b;
  font-family: var(--font-display);
  font-size: clamp(1.05rem, 2.35vh, 1.38rem);
  font-weight: 700;
  line-height: 1;
}

.device.is-playing .history-slot .hist-time {
  grid-column: 2;
  grid-row: 1;
  align-self: center;
  color: rgba(230, 192, 94, 0.78);
  font-size: clamp(0.56rem, 1.08vh, 0.69rem);
  line-height: 1;
  letter-spacing: 0;
  white-space: nowrap;
}

.device.is-playing .history-slot.is-empty::after {
  content: "";
  grid-column: 1 / -1;
  width: clamp(24px, 2.5vw, 36px);
  height: 2px;
  border: 0;
  border-radius: 1px;
  background: rgba(235, 194, 90, 0.2);
}

.device.is-playing .hist-foot {
  flex: 0 0 auto;
  width: 100%;
  min-height: clamp(38px, 5vh, 46px);
  justify-content: flex-start;
  gap: clamp(7px, 0.65vw, 10px);
  padding: clamp(6px, 0.8vh, 9px) clamp(10px, 0.8vw, 14px);
  border: 1px solid rgba(222, 171, 60, 0.5);
  border-radius: 7px;
  background: rgba(48, 31, 15, 0.52);
  box-shadow: inset 0 1px 0 rgba(255, 225, 147, 0.06);
  color: #efd17b;
  font-size: clamp(0.67rem, 1.4vh, 0.82rem);
}

.device.is-playing .hist-foot img {
  flex: 0 0 auto;
  width: clamp(16px, 1.3vw, 20px);
  height: clamp(16px, 1.3vw, 20px);
  object-fit: contain;
  object-position: center;
}

.device.is-playing .hist-foot b {
  min-width: 24px;
  margin-left: auto;
  padding: 2px 7px;
  border: 1px solid rgba(224, 175, 65, 0.16);
  border-radius: 999px;
  background: rgba(221, 169, 48, 0.14);
  color: #f8da83;
  font-size: 0.92em;
  line-height: 1.25;
  text-align: center;
}

@media (min-width: 933px) and (max-height: 800px) {
  .device.is-playing .history {
    --hist-pad-x: clamp(11px, 0.9vw, 15px);
    --hist-pad-y: clamp(10px, 1.2vh, 14px);
    height: min(calc(100% - 8px), 590px);
  }

  .device.is-playing .hist-inner {
    gap: 5px;
  }

  .device.is-playing .history-slot {
    padding-block: 3px;
  }

  .device.is-playing .history-slot .hist-die {
    width: clamp(32px, 4.7vh, 40px);
    height: clamp(32px, 4.7vh, 40px);
  }

  .device.is-playing .hist-foot {
    min-height: 38px;
  }
}

@media (max-width: 932px) and (orientation: landscape) {
  .device.is-playing {
    grid-template-columns: clamp(118px, 18vw, 142px) minmax(0, 1fr) clamp(180px, 27vw, 250px);
  }

  .device.is-playing .history {
    --hist-pad-x: clamp(6px, 1.4vw, 10px);
    --hist-pad-y: clamp(6px, 1.8vh, 9px);
    width: 100%;
    height: calc(100% - 4px);
    max-height: none;
    border-radius: 8px;
  }

  .device.is-playing .hist-inner {
    gap: 3px;
  }

  .device.is-playing .hist-title {
    min-height: 19px;
    padding-bottom: 4px;
    font-size: clamp(0.55rem, 2.3vh, 0.65rem);
  }

  .device.is-playing .history-slot {
    padding: 3px 2px;
    gap: 4px;
  }

  .device.is-playing .history-slot:nth-child(n + 5) {
    display: none;
  }

  .device.is-playing .history-slot .hist-row {
    gap: 5px;
  }

  .device.is-playing .history-slot .hist-die {
    width: clamp(24px, 7.4vh, 30px);
    height: clamp(24px, 7.4vh, 30px);
  }

  .device.is-playing .history-slot .hist-num {
    font-size: clamp(0.74rem, 3.1vh, 0.9rem);
  }

  .device.is-playing .history-slot .hist-time {
    display: block;
    font-size: clamp(0.48rem, 1.9vh, 0.56rem);
  }

  .device.is-playing .history-slot.is-empty::after {
    width: 24px;
    height: 1px;
  }

  .device.is-playing .hist-foot {
    min-height: clamp(29px, 7.8vh, 34px);
    padding: 4px 6px;
    gap: 5px;
    border-radius: 5px;
    font-size: clamp(0.52rem, 2.1vh, 0.62rem);
  }

  .device.is-playing .hist-foot img {
    width: 15px;
    height: 15px;
  }

  .device.is-playing .hist-foot span {
    white-space: nowrap;
  }

  .device.is-playing .hist-foot b {
    min-width: 19px;
    padding: 1px 5px;
  }
}
