/* An offer and its gamble are separate controls, with no nested buttons. */
.upgrade-dialog {
  max-height: calc(100dvh - 36px);
  overflow: auto;
  padding: 12px;
}
.upgrade-card {
  padding: 0 0 15px;
  overflow: hidden;
}
.upgrade-pick,
.upgrade-pick:is(:hover, :focus-visible, :active) {
  display: flex;
  flex: 1;
  flex-direction: column;
  align-items: center;
  width: 100%;
  padding: 22px 18px 16px;
  color: inherit;
  text-align: center;
  background: transparent;
  border: 0;
  border-image: none;
  box-shadow: none;
  transform: none;
  filter: none;
}
.upgrade-pick:focus-visible {
  outline: 2px solid var(--quality);
  outline-offset: -5px;
}
.upgrade-card:has(.upgrade-pick:disabled) {
  opacity: 0.65;
}
.risk-button,
.risk-button:is(:hover, :focus-visible, :active) {
  flex: none;
  min-height: 42px;
  width: calc(100% - 32px);
  padding: 7px 12px;
  border: 1px solid #bc783c;
  border-image: none;
  background: linear-gradient(#70291c, #2b100b);
  color: #ffdb9e;
  font: 17px var(--heading);
  letter-spacing: 1px;
  box-shadow:
    inset 0 0 12px #d2893238,
    0 0 12px #e66b2338;
  animation: risk-beckon 2.7s ease-in-out infinite;
  transform-origin: center;
}
.risk-button:hover,
.risk-button:focus-visible {
  border-color: #ffe2a1;
  color: #fff0c9;
}
.risk-button:disabled {
  animation: none;
  opacity: 0.5;
}
.risk-button span {
  font-size: 12px;
  padding-inline: 3px;
}
.risk-card-help {
  margin: -6px auto 14px;
  color: #ba9c7b;
  font-size: 12px;
  line-height: 1.6;
}
.risk-card-help b {
  color: #e7967e;
  font-weight: normal;
}
@keyframes risk-beckon {
  0%,
  55%,
  100% {
    transform: translateY(0) scale(1);
    box-shadow:
      inset 0 0 12px #d2893238,
      0 0 9px #e66b2338;
  }
  25% {
    transform: translateY(-3px) scale(1.025);
    box-shadow:
      inset 0 0 17px #e6ac5260,
      0 0 23px #e66b2370;
  }
  38% {
    transform: translateY(1px) scale(1.01);
  }
}
.risk-dialog {
  width: min(1000px, 96vw);
}
.risk-roll {
  --reel-cell: clamp(112px, 17vw, 164px);
  padding-block: 20px 8px;
}
.risk-offer {
  color: #a99a7d;
  font-size: 13px;
  margin-bottom: 18px;
}
.risk-offer strong {
  color: #dac391;
}
.risk-window {
  position: relative;
  height: 192px;
  overflow: hidden;
  border-block: 2px ridge #8c6c3e;
  background: #080605;
  box-shadow: inset 0 0 30px #000;
}
.risk-window::before {
  content: "";
  position: absolute;
  z-index: 2;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(
    90deg,
    #080605ed,
    transparent 27%,
    transparent 73%,
    #080605ed
  );
}
.risk-window::after {
  content: "";
  position: absolute;
  z-index: 3;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: #f6d893;
  box-shadow: 0 0 12px #f6c779;
}
.risk-track {
  position: relative;
  left: 50%;
  display: flex;
  width: max-content;
  height: 100%;
  transform: translateX(calc(var(--reel-cell) * -27.5));
  animation: risk-spin var(--reel-duration) cubic-bezier(0.12, 0.65, 0.13, 1)
    var(--reel-delay) both;
}
.risk-tile {
  flex: 0 0 var(--reel-cell);
  width: var(--reel-cell);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border: 4px solid #080605;
  border-bottom: 5px solid #9c4435;
  background: radial-gradient(ellipse at 50% 40%, #4e201d, #140c0b);
  color: #d7a496;
  text-align: center;
}
.risk-tile img {
  width: 62px;
  height: 62px;
  object-fit: contain;
}
.risk-tile strong {
  font-size: 13px;
  min-height: 30px;
}
.risk-tile small {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.risk-tile[data-tier="reward"] {
  border-bottom-color: #7baab8;
  background: radial-gradient(ellipse at 50% 40%, #273e4e, #0c1014);
  color: #b8d2e5;
}
.risk-tile[data-tier="jackpot"] {
  border-bottom-color: #f4cc6c;
  background: radial-gradient(ellipse at 50% 40%, #685126, #1c1508);
  color: #ffe3a0;
}
@keyframes risk-spin {
  from {
    transform: translateX(calc(var(--reel-cell) * -1.5));
  }
  to {
    transform: translateX(calc(var(--reel-cell) * -27.5));
  }
}
.risk-result {
  visibility: hidden;
  min-height: 108px;
  padding-top: 20px;
  color: #e7a08a;
}
.risk-result h3 {
  font: 25px var(--heading);
  margin: 0 0 8px;
}
.risk-result p {
  font-size: 14px;
  margin: 0 0 7px;
}
.risk-result small {
  font-size: 11px;
  color: #aa967c;
}
.risk-result[data-tier="reward"] {
  color: #b8d2e5;
}
.risk-result[data-tier="jackpot"] {
  color: #ffe3a0;
}
.revealed .risk-result {
  visibility: visible;
}
.risk-spinning {
  margin-top: -86px;
  height: 86px;
  display: grid;
  place-content: center;
  color: #d4bb8c;
}
.risk-spinning[hidden] {
  display: none;
}
.risk-odds {
  color: #c7b591;
  font-size: 13px;
  margin: 15px 0 8px;
}
.risk-odds span:first-child {
  color: #e7967e;
}
.risk-odds span:last-child {
  color: #f1cc7c;
}
.risk-note {
  margin: 0 auto;
  max-width: 680px;
  color: #9b8a70;
  font-size: 12px;
  line-height: 1.6;
}
.still-reel .risk-track {
  animation: none;
}
.reduce-motion .risk-button {
  animation: none;
}
@media (prefers-reduced-motion: reduce) {
  .risk-button,
  .risk-track {
    animation: none;
  }
}
@media (max-width: 640px) {
  .upgrade-cards {
    gap: 8px;
  }
  .upgrade-card {
    padding-bottom: 10px;
  }
  .upgrade-pick {
    padding: 18px 9px 12px;
  }
  .risk-button {
    width: calc(100% - 16px);
    min-height: 36px;
    font-size: 14px;
  }
  .risk-card-help {
    font-size: 11px;
  }
  .risk-window {
    height: 168px;
  }
  .risk-result {
    min-height: 128px;
  }
}

/* Preserve native inventory geometry by scaling the whole workspace together.
   Hit testing uses its rendered rectangle, so click and drag retain exact cells. */
@media (min-width: 1600px) and (min-height: 900px) {
  :root {
    --side-panel: clamp(290px, 20vw, 440px);
    --large-panel-scale: 1.2;
  }
  .menu {
    max-width: 3400px;
    width: 100%;
    padding: 24px clamp(32px, 3vw, 90px) 16px;
    gap: 18px;
  }
  .masthead {
    min-height: 82px;
  }
  .masthead .brand-art {
    width: 340px;
    height: 82px;
  }
  .tabbar {
    min-height: 46px;
    gap: clamp(28px, 4vw, 88px);
  }
  .tabbar button {
    font-size: 17px;
    padding-block: 12px;
  }
  .menu-main,
  .menu-controls {
    gap: clamp(24px, 2.5vw, 64px);
  }
  .panel-head {
    font-size: 15px;
    margin: 18px 18px 14px;
  }
  .class-option {
    min-height: 64px;
    padding: 5px 11px;
    gap: 12px;
  }
  .class-option strong {
    font-size: 17px;
  }
  .class-option small {
    font-size: 12px;
  }
  .class-option canvas.class-thumbnail {
    width: 54px;
    height: 68px;
    flex-basis: 54px;
  }
  .class-option .class-icon {
    width: 21px;
    height: 24px;
  }
  .hero-name {
    font-size: clamp(36px, 2.4vw, 54px);
  }
  .hero-stage canvas {
    max-height: min(49vh, 800px);
  }
  .hero-abilities {
    gap: 8px;
    padding-block: 12px;
  }
  .hero-abilities button {
    width: 46px;
    height: 46px;
  }
  .active-picker-panel {
    max-width: 680px;
    margin-inline: auto;
  }
  .active-picker img {
    width: 52px;
    height: 52px;
  }
  .active-picker strong {
    font-size: 17px;
  }
  .active-picker small {
    font-size: 12px;
  }
  .zone-option {
    padding: 10px;
    gap: 14px;
  }
  .zone-option strong {
    font-size: 16px;
  }
  .zone-option small {
    font-size: 12px;
  }
  .act-medallion {
    width: 46px;
    height: 50px;
    min-width: 46px;
  }
  .area-picker {
    padding: 18px;
  }
  .area-picker label,
  .boss-preview,
  .boss-preview small {
    font-size: 13px;
  }
  .select-trigger {
    min-height: 44px;
    font-size: 15px;
  }
  .select-options button {
    min-height: 44px;
    font-size: 15px;
  }
  .start-controls .enter-button {
    min-height: 58px;
    font-size: 20px;
  }
  .view-header h2 {
    font-size: 29px;
  }
  .full-panel {
    padding: 24px;
  }
  .view-header {
    margin-bottom: 20px;
  }
  .economy-page .armory-workspace {
    zoom: var(--large-panel-scale);
    gap: 24px 48px;
  }
  .talent-grid {
    gap: clamp(24px, 2.5vw, 64px);
  }
  .talent-tree {
    padding: 24px;
  }
  .talent-tree h3 {
    font-size: 21px;
    margin-bottom: 25px;
  }
  .talent-node {
    padding: 18px 0;
    gap: 16px;
  }
  .talent-node img {
    width: 52px;
    height: 52px;
  }
  .talent-node strong {
    font-size: 16px;
  }
  .talent-node small {
    font-size: 13px;
  }
  .talent-plus {
    width: 40px;
    height: 40px;
  }
  .bestiary-grid {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 22px;
  }
  .monster-card {
    padding: 14px;
  }
  .monster-card .monster-preview,
  .arms-preview {
    height: clamp(190px, 22vh, 340px);
  }
  .monster-card h3 {
    font-size: 18px;
  }
  .monster-card small {
    font-size: 13px;
  }
  .arms-preview img {
    max-height: 180px;
    max-width: 150px;
  }
  .bestiary-inner-title h3 {
    font-size: 22px;
  }
  .record-row.rich-record {
    padding: 17px 20px;
  }
  .record-row.rich-record :is(strong, span, small) {
    font-size: 15px;
  }
  .achievement-grid {
    grid-template-columns: repeat(auto-fit, minmax(330px, 1fr));
    gap: 20px;
  }
  .achievement-card {
    padding: 20px;
  }
  .achievement-card h3 {
    font-size: 19px;
  }
  .achievement-card p {
    font-size: 15px;
  }
  .dialog {
    max-height: calc(100dvh - 64px);
  }
  .settings-dialog.options-dialog {
    width: min(1000px, 80vw);
    height: min(950px, 86dvh);
    padding: 32px;
  }
  .settings-tabs button,
  .setting-row {
    font-size: 16px;
  }
  .options-dialog .setting-row {
    min-height: 58px;
  }
  .expedition-report {
    width: min(1280px, 88vw);
  }
  .report-chart {
    padding: 20px 16px 8px;
  }
  .report-ability-bars span,
  .report-ability-bars strong,
  .report-ability-bars small {
    font-size: 15px;
  }
  .run-inventory {
    width: max-content;
    max-width: 94vw;
  }
  .run-inventory-workspace {
    zoom: var(--large-panel-scale);
  }
  .upgrade-dialog {
    width: min(1200px, 88vw);
  }
  .upgrade-pick {
    padding: 30px 25px 22px;
  }
  .upgrade-card {
    min-height: 390px;
  }
  .upgrade-card img {
    width: 80px;
    height: 80px;
  }
  .upgrade-card h3 {
    font-size: 23px;
  }
  .upgrade-card p,
  .upgrade-card .card-bonus {
    font-size: 16px;
  }
  .upgrade-card .rarity {
    font-size: 13px;
  }
  .risk-button {
    min-height: 50px;
    font-size: 21px;
  }
  .risk-card-help,
  .upgrade-subtitle {
    font-size: 15px;
  }
  .native-hud {
    width: min(88vw, clamp(1050px, 105vh, 1680px));
  }
  .damage-meter {
    width: 280px;
    right: 28px;
    padding: 16px;
  }
  .damage-meter-title strong {
    font-size: 16px;
  }
  .damage-name,
  .damage-total,
  .damage-dps {
    font-size: 12px;
  }
  .party-hud {
    width: 230px;
    left: 28px;
    gap: 12px;
  }
  .party-member {
    grid-template-columns: 46px 1fr;
    padding: 6px;
  }
  .party-member > img {
    width: 46px;
    height: 46px;
  }
  .party-member small {
    font-size: 14px;
  }
  .game-tooltip {
    max-width: 430px;
    font-size: 15px;
  }
}
@media (min-width: 2200px) and (min-height: 1200px) {
  :root {
    --side-panel: clamp(360px, 19vw, 520px);
    --large-panel-scale: 1.55;
  }
  .menu {
    gap: 26px;
    padding-top: 32px;
  }
  .masthead {
    min-height: 104px;
  }
  .masthead .brand-art {
    width: 430px;
    height: 104px;
  }
  .masthead :is(.icon-button, .account-button) {
    height: 44px;
    min-height: 44px;
    font-size: 15px;
  }
  .masthead .header-actions .icon-button {
    height: 44px;
    width: 54px;
  }
  .tabbar button {
    font-size: 21px;
  }
  .panel-head {
    font-size: 18px;
  }
  .class-option strong {
    font-size: 21px;
  }
  .class-option small {
    font-size: 15px;
  }
  .class-option canvas.class-thumbnail {
    width: 72px;
    height: 90px;
    flex-basis: 72px;
  }
  .hero-abilities button {
    width: 58px;
    height: 58px;
  }
  .active-picker-panel {
    max-width: 780px;
  }
  .active-picker strong {
    font-size: 20px;
  }
  .active-picker small {
    font-size: 14px;
  }
  .zone-option strong {
    font-size: 20px;
  }
  .zone-option small {
    font-size: 15px;
  }
  .act-medallion {
    width: 58px;
    height: 64px;
    min-width: 58px;
  }
  .select-trigger,
  .select-options button {
    font-size: 18px;
    min-height: 52px;
  }
  .bestiary-grid {
    grid-template-columns: repeat(6, minmax(0, 1fr));
  }
  .talent-node img {
    width: 64px;
    height: 64px;
  }
  .talent-node strong {
    font-size: 19px;
  }
  .talent-node small {
    font-size: 16px;
  }
  .talent-node {
    padding: 24px 0;
  }
  .upgrade-dialog {
    width: min(1500px, 85vw);
  }
  .upgrade-card {
    min-height: 480px;
  }
  .upgrade-card img {
    width: 100px;
    height: 100px;
  }
  .upgrade-card h3 {
    font-size: 28px;
  }
  .upgrade-card p,
  .upgrade-card .card-bonus {
    font-size: 19px;
  }
  .risk-roll {
    --reel-cell: 210px;
  }
  .risk-window {
    height: 260px;
  }
  .risk-tile img {
    width: 90px;
    height: 90px;
  }
  .risk-tile strong {
    font-size: 18px;
  }
  .risk-result h3 {
    font-size: 32px;
  }
  .risk-result p,
  .risk-odds {
    font-size: 18px;
  }
}
@media (min-width: 3200px) and (min-height: 1800px) {
  :root {
    --side-panel: 570px;
    --large-panel-scale: 2.1;
  }
  .menu {
    max-width: 3660px;
    gap: 34px;
    padding-top: 44px;
  }
  .hero-stage canvas {
    max-height: 1040px;
  }
  .class-option canvas.class-thumbnail {
    width: 92px;
    height: 115px;
    flex-basis: 92px;
  }
  .class-option strong {
    font-size: 25px;
  }
  .class-option small {
    font-size: 18px;
  }
  .hero-name {
    font-size: 64px;
  }
  .talent-node img {
    width: 80px;
    height: 80px;
  }
  .talent-node strong {
    font-size: 24px;
  }
  .talent-node small {
    font-size: 19px;
  }
  .talent-tree h3 {
    font-size: 30px;
  }
  .bestiary-grid {
    gap: 32px;
  }
  .monster-card .monster-preview,
  .arms-preview {
    height: 600px;
  }
  .monster-card h3 {
    font-size: 24px;
  }
  .monster-card small {
    font-size: 17px;
  }
  .settings-dialog.options-dialog {
    width: 1200px;
    height: 1200px;
  }
  .expedition-report {
    width: min(1800px, 85vw);
  }
}

@media (min-width: 3200px) and (min-height: 1800px) {
  .masthead {
    min-height: 140px;
  }
  .masthead .brand-art {
    width: 560px;
    height: 135px;
  }
  .masthead :is(.icon-button, .account-button) {
    height: 58px;
    min-height: 58px;
    font-size: 22px;
  }
  .masthead .account-button {
    max-width: 200px;
  }
  .masthead .header-actions .icon-button {
    height: 58px;
    width: 70px;
  }
  .tabbar button {
    font-size: 28px;
  }
  .view-header h2 {
    font-size: 40px;
  }
  .bestiary-inner-title h3 {
    font-size: 32px;
  }
  .select-trigger,
  .select-options button {
    font-size: 22px;
    min-height: 62px;
  }
  .hero-abilities button {
    width: 76px;
    height: 76px;
  }
  .active-picker strong {
    font-size: 24px;
  }
  .active-picker img {
    width: 66px;
    height: 66px;
  }
  .bestiary-pagination button,
  .bestiary-tabs button,
  .chronicle-tabs button {
    font-size: 20px;
    min-height: 48px;
  }
  .monster-card :is(.enemy-info-button, .rotate-left, .rotate-right) {
    width: 42px;
    height: 42px;
    font-size: 25px;
  }
}

@media (max-width: 640px) {
  .upgrade-card {
    display: flex;
    grid-template-columns: none;
    min-height: 0;
  }
  .upgrade-pick {
    display: grid;
    grid-template-columns: 46px minmax(0, 1fr);
    gap: 0 12px;
    text-align: left;
    align-items: start;
  }
  .upgrade-card img {
    grid-column: 1;
    grid-row: 1 / 5;
  }
  .upgrade-card :is(.rarity, h3, p, .card-bonus) {
    grid-column: 2;
  }
}
.risk-button,
.risk-button:is(:hover, :focus-visible, :active) {
  --risk-art: var(--hd-button-small-0);
  background-image: linear-gradient(#791e1444, #24080455), var(--risk-art);
  background-size: 100% 100%;
}
.risk-button:is(:hover, :focus-visible) {
  --risk-art: var(--hd-button-small-1);
}
.risk-button:active {
  --risk-art: var(--hd-button-small-3);
}
@media (min-width: 1600px) and (min-height: 900px) {
  #diablo-tooltip {
    max-width: 450px;
    font-size: 15px;
  }
  #diablo-tooltip .item-tip > strong {
    font-size: 20px;
  }
}
@media (min-width: 3200px) and (min-height: 1800px) {
  #diablo-tooltip {
    max-width: 560px;
    font-size: 21px;
  }
  #diablo-tooltip .item-tip > strong {
    font-size: 26px;
  }
}

@media (min-width: 1600px) and (min-height: 900px) {
  .talent-grid {
    min-height: 62dvh;
    align-items: stretch;
  }
  .talent-tree {
    display: flex;
    flex-direction: column;
  }
  .talent-node {
    flex: 1;
  }
  .talents-page .talent-experience {
    width: min(100%, 1000px);
    max-width: none;
    margin: 0 auto 24px;
  }
  .talent-xp > span,
  .talent-xp small,
  .talent-character-level,
  .talent-unspent {
    font-size: 14px;
  }
  .zone-label strong {
    font-size: 23px;
  }
  .zone-label small {
    font-size: 13px;
  }
  .timer-block time {
    font-size: 42px;
  }
  .timer-block small {
    font-size: 13px;
  }
  .top-actions {
    font-size: 20px;
  }
  .boss-hud {
    width: 480px;
    top: 110px;
  }
  .boss-hud strong {
    font-size: 21px;
  }
  .damage-meter {
    top: 255px;
    max-height: calc(100dvh - 470px);
  }
  .party-hud {
    top: 110px;
  }
}
@media (min-width: 3200px) and (min-height: 1800px) {
  .talents-page .talent-experience {
    width: 1500px;
    margin-bottom: 36px;
  }
  .talent-xp > span,
  .talent-xp small,
  .talent-character-level,
  .talent-unspent {
    font-size: 22px;
  }
  .talent-xp > div {
    height: 16px;
  }
  .top-hud {
    top: 38px;
    left: 50px;
    right: 50px;
  }
  .zone-label strong {
    font-size: 34px;
  }
  .zone-label small {
    font-size: 19px;
  }
  .timer-block time {
    font-size: 60px;
  }
  .timer-block small {
    font-size: 19px;
  }
  .top-actions {
    font-size: 28px;
  }
  .top-actions .icon-button {
    min-width: 58px;
    min-height: 58px;
    font-size: 24px;
  }
  .boss-hud {
    top: 175px;
    width: 680px;
  }
  .boss-hud strong {
    font-size: 29px;
  }
  .boss-hud .track {
    height: 12px;
  }
  .party-hud {
    top: 170px;
    left: 50px;
    width: 330px;
  }
  .party-member {
    grid-template-columns: 64px 1fr;
    gap: 12px;
    padding: 8px;
  }
  .party-member > img {
    width: 64px;
    height: 64px;
  }
  .party-member small {
    font-size: 20px;
  }
  .damage-meter {
    width: 390px;
    right: 50px;
    top: 330px;
    padding: 22px;
  }
  .damage-meter-title {
    font-size: 22px;
  }
  .damage-meter-title strong,
  .damage-name,
  .damage-total,
  .damage-dps {
    font-size: 18px;
  }
  .damage-row {
    grid-template-columns: 40px minmax(0, 1fr) auto;
    gap: 10px;
    padding-block: 12px;
  }
  .damage-row img {
    width: 40px;
    height: 40px;
  }
}

@media (min-width: 1600px) and (min-height: 900px) {
  :root {
    --large-dialog-scale: 1.15;
  }
  .dialog:not(.settings-dialog):not(.run-inventory):not(.expedition-report) {
    zoom: var(--large-dialog-scale);
    max-width: calc((100vw - 64px) / var(--large-dialog-scale));
    max-height: calc((100dvh - 64px) / var(--large-dialog-scale));
  }
  .menu-footer,
  .menu-footer button {
    font-size: 12px;
  }
}
@media (min-width: 2200px) and (min-height: 1200px) {
  :root {
    --large-dialog-scale: 1.35;
  }
}
@media (min-width: 3200px) and (min-height: 1800px) {
  :root {
    --large-dialog-scale: 1.8;
  }
  .menu-footer,
  .menu-footer button {
    font-size: 17px;
  }
}

@media (min-width: 1600px) and (min-height: 900px) {
  .damage-meter {
    top: clamp(290px, 24vh, 520px);
  }
  #buff-hud {
    left: 290px;
    top: 130px;
    max-width: 500px;
  }
  #buff-hud .buff-clock {
    width: 52px;
    height: 52px;
  }
  .buff-clock b {
    font-size: 13px;
    bottom: -18px;
  }
  .native-control-hints {
    font-size: 14px;
    gap: 28px;
  }
  .native-control-hints kbd {
    font-size: 13px;
  }
}
@media (min-width: 3200px) and (min-height: 1800px) {
  .damage-meter {
    top: clamp(480px, 24vh, 600px);
    max-height: calc(100dvh - 780px);
  }
  #buff-hud {
    left: 420px;
    top: 175px;
    max-width: 650px;
    gap: 18px;
  }
  #buff-hud .buff-clock {
    width: 72px;
    height: 72px;
  }
  .buff-clock b {
    font-size: 19px;
    bottom: -23px;
  }
  .native-control-hints {
    font-size: 20px;
    gap: 36px;
    bottom: calc(100% + 18px);
  }
  .native-control-hints kbd {
    font-size: 18px;
  }
}
