:root {
  --hb-forest-black: var(--hb-ui-ink);
  --hb-forest-green: var(--hb-ui-forest);
  --hb-frame-gold: var(--hb-ui-gold);
  --hb-heading-gold: var(--hb-ui-gold-bright);
  --hb-text-ivory: var(--hb-ui-ivory);
  --hb-sheet-width: var(--hb-ui-sheet-width);
  --hb-sheet-height: var(--hb-ui-sheet-height);
  --hb-sheet-left: var(--hb-ui-sheet-left);
  --hb-sheet-top: var(--hb-ui-sheet-top);
  --hb-pause-left: 395px;
  --hb-pause-top: 255px;
  --hb-pause-width: 496px;
  --hb-pause-height: 426px;
  --hb-stage-scale: 1;
  --hb-stage-left: 0px;
  --hb-stage-top: 0px;
  --hb-rarity-uncommon: var(--hb-ui-rarity-uncommon);
  --hb-rarity-rare: var(--hb-ui-rarity-rare);
  --hb-rarity-epic: var(--hb-ui-rarity-epic);
  --hb-rarity-legendary: var(--hb-ui-rarity-legendary);
}

.hb-pause__desktop-title { display: none; }

@media (hover: hover) and (pointer: fine) {
  body[data-view="run"] .desktop-overlay-root[data-active="true"] {
    background: rgba(0, 0, 0, .65);
    backdrop-filter: none;
  }

  body[data-view="run"] .pause-overlay,
  body[data-view="run"] .stats-modal {
    position: fixed;
    inset: 0;
    display: block;
    overflow: hidden;
    padding: 0;
    border: 0;
    border-radius: 0;
    background: transparent;
    backdrop-filter: none;
    color: var(--hb-text-ivory);
    font-family: var(--hb-font-display);
    text-align: left;
  }

  body[data-view="run"] .pause-overlay[hidden],
  body[data-view="run"] .stats-modal[hidden] { display: none; }

  body[data-view="run"] .hb-pause {
    position: absolute;
    left: calc(var(--hb-stage-left) + var(--hb-pause-left) * var(--hb-stage-scale));
    top: calc(var(--hb-stage-top) + var(--hb-pause-top) * var(--hb-stage-scale));
    width: var(--hb-pause-width);
    height: var(--hb-pause-height);
    overflow: hidden;
    transform: scale(var(--hb-stage-scale));
    transform-origin: top left;
    background:
      linear-gradient(rgba(2, 16, 8, .88), rgba(1, 14, 7, .96)),
      repeating-linear-gradient(45deg, #010e07 0 7px, #010f08 7px 8px);
    box-shadow: 0 9px 22px rgba(0, 0, 0, .58);
  }

  body[data-view="run"] .hb-pause::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 20;
    pointer-events: none;
    background: url('./assets/desktop_pause_frame_v1.png') 0 0 / 496px 426px no-repeat;
  }

  body[data-view="run"] .hb-pause__header {
    position: absolute;
    left: 22px;
    right: 22px;
    top: 0;
    height: 86px;
    display: grid;
    place-items: center;
    border-bottom: 2px solid var(--hb-frame-gold);
  }

  body[data-view="run"] .hb-pause__header::after {
    content: '◇';
    position: absolute;
    left: 50%;
    bottom: -12px;
    transform: translateX(-50%);
    padding: 0 5px;
    background: var(--hb-forest-black);
    color: var(--hb-frame-gold);
    font-size: 14px;
    line-height: 20px;
  }

  body[data-view="run"] .hb-pause__title {
    margin: 4px 0 0;
    color: var(--hb-heading-gold);
    font-size: 42px;
    font-weight: 500;
    letter-spacing: 2px;
    line-height: 1;
    text-transform: uppercase;
  }

  body[data-view="run"] .hb-pause__desktop-title { display: inline; }
  body[data-view="run"] .hb-pause__mobile-title,
  body[data-view="run"] .hb-pause__description { display: none; }

  body[data-view="run"] .pause-overlay__actions.hb-pause__actions {
    position: absolute;
    left: 22px;
    right: 22px;
    top: 109px;
    width: auto;
    height: auto;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    grid-auto-rows: 64px;
    gap: 13px 14px;
    overflow: visible;
  }

  body[data-view="run"] .hb-pause__button {
    position: relative;
    min-width: 0;
    min-height: 0;
    padding: 0;
    border: var(--hb-ui-action-border-standard) solid var(--hb-frame-gold);
    border-radius: 0;
    background: var(--hb-forest-green);
    color: var(--hb-text-ivory);
    font-size: 20px;
    font-weight: 500;
    letter-spacing: .5px;
    line-height: 1;
    text-transform: uppercase;
  }

  body[data-view="run"] .hb-pause__button::after,
  body[data-view="run"] .hb-sheet__back::after,
  body[data-view="run"] .hb-settings-mute::after {
    content: '';
    position: absolute;
    inset: var(--hb-ui-action-inner-standard);
    pointer-events: none;
    border: 1px solid rgba(216, 152, 32, .42);
  }

  body[data-view="run"] .hb-pause__button:hover,
  body[data-view="run"] .hb-pause__button:focus-visible,
  body[data-view="run"] .hb-sheet__back:hover,
  body[data-view="run"] .hb-sheet__back:focus-visible,
  body[data-view="run"] .hb-settings-mute:hover,
  body[data-view="run"] .hb-settings-mute:focus-visible { background: #173819; }

  body[data-view="run"] .hb-pause__button--wide {
    grid-column: 1 / -1;
    font-size: 23px;
  }

  body[data-view="run"] .hb-pause__button--leave { background: #5b2318; }
  body[data-view="run"] .hb-pause__button--leave:hover,
  body[data-view="run"] .hb-pause__button--leave:focus-visible { background: #743024; }

  body[data-view="run"] .stats-modal__panel.hb-sheet {
    position: absolute;
    left: calc(var(--hb-stage-left) + var(--hb-sheet-left) * var(--hb-stage-scale));
    top: calc(var(--hb-stage-top) + var(--hb-sheet-top) * var(--hb-stage-scale));
    width: var(--hb-sheet-width);
    height: var(--hb-sheet-height);
    max-width: none;
    max-height: none;
    display: block;
    overflow: hidden;
    padding: 0;
    border: 0;
    border-radius: 0;
    transform: scale(var(--hb-stage-scale));
    transform-origin: top left;
    background:
      linear-gradient(rgba(2, 16, 8, .78), rgba(1, 14, 7, .88)),
      repeating-linear-gradient(45deg, #010e07 0 7px, #010f08 7px 8px);
    box-shadow: 0 9px 22px rgba(0, 0, 0, .58);
  }

  body[data-view="run"] .stats-modal__panel.hb-sheet::after {
    content: '';
    position: absolute;
    inset: 0;
    z-index: 20;
    pointer-events: none;
    background: url('./assets/desktop_shared_sheet_frame_v1.png') 0 0 / 947px 644px no-repeat;
  }

  body[data-view="run"] .hb-sheet > .stats-modal__head {
    position: absolute;
    left: 28px;
    right: 28px;
    top: 0;
    height: 95px;
    display: grid;
    place-items: center;
    border-bottom: 2px solid var(--hb-frame-gold);
  }

  body[data-view="run"] .hb-sheet > .stats-modal__head::after {
    content: '◇';
    position: absolute;
    left: 50%;
    bottom: -12px;
    transform: translateX(-50%);
    padding: 0 8px;
    background: var(--hb-forest-black);
    color: var(--hb-frame-gold);
    font-size: 16px;
    line-height: 20px;
  }

  body[data-view="run"] .hb-sheet > .stats-modal__head > div { display: contents; }
  body[data-view="run"] .hb-sheet > .stats-modal__head p,
  body[data-view="run"] .hb-sheet > .stats-modal__head span,
  body[data-view="run"] .hb-sheet > .stats-modal__head .stats-modal__close { display: none; }

  body[data-view="run"] .hb-sheet > .stats-modal__head h2 {
    margin: 5px 0 0;
    color: var(--hb-heading-gold);
    font-size: 42px;
    font-weight: 500;
    letter-spacing: 2px;
    line-height: 1;
    text-align: center;
    text-transform: uppercase;
  }

  body[data-view="run"] .hb-sheet .stats-modal__body {
    position: static;
    overflow: visible;
  }

  body[data-view="run"] .hb-sheet__main {
    position: absolute;
    left: 28px;
    right: 28px;
    top: 120px;
    width: auto;
    height: 432px;
    min-height: 0;
    display: grid;
    grid-template-columns: 375px 492px;
    gap: 24px;
    overflow: visible;
  }

  body[data-view="run"] .hb-reference-list,
  body[data-view="run"] .hb-detail,
  body[data-view="run"] .hb-settings-panel {
    min-width: 0;
    min-height: 0;
    border: 1px solid var(--hb-frame-gold);
    background: rgba(1, 14, 7, .94);
  }

  body[data-view="run"] .hb-reference-list { overflow: hidden; }
  body[data-view="run"] .hb-list-heading,
  body[data-view="run"] .hb-reference-row { margin: 0 13px; padding: 0 7px; }

  body[data-view="run"] .hb-list-heading {
    height: 36px;
    border-bottom: 1px solid rgba(216, 152, 32, .66);
    color: var(--hb-frame-gold);
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 4px;
  }

  body[data-view="run"] .hb-reference-row {
    position: relative;
    width: calc(100% - 26px);
    min-width: 0;
    padding-inline: 7px;
    border: 0;
    border-bottom: 1px solid rgba(216, 152, 32, .28);
    border-radius: 0;
    background: transparent;
    color: var(--hb-text-ivory);
    cursor: default;
    font-weight: 500;
    text-align: left;
  }

  body[data-view="run"] .hb-reference-row:last-child { border-bottom: 0; }
  body[data-view="run"] .hb-reference-row.is-previewed,
  body[data-view="run"] .hb-reference-row:hover,
  body[data-view="run"] .hb-reference-row:focus-visible {
    background: var(--hb-forest-green);
    outline: 0;
  }

  body[data-view="run"] .hb-reference-row.is-previewed::before,
  body[data-view="run"] .hb-reference-row:hover::before,
  body[data-view="run"] .hb-reference-row:focus-visible::before {
    content: '';
    position: absolute;
    left: -7px;
    width: 4px;
    background: var(--hb-frame-gold);
  }

  body[data-view="run"] .hb-detail {
    position: relative;
    padding: 27px;
    overflow-y: auto;
    overscroll-behavior: contain;
  }

  body[data-view="run"] .hb-detail::before,
  body[data-view="run"] .hb-detail::after,
  body[data-view="run"] .hb-settings-panel::before,
  body[data-view="run"] .hb-settings-panel::after {
    content: '';
    position: absolute;
    width: 12px;
    height: 12px;
    border-color: var(--hb-frame-gold);
    pointer-events: none;
  }

  body[data-view="run"] .hb-detail::before,
  body[data-view="run"] .hb-settings-panel::before {
    left: 8px;
    top: 8px;
    border-left: 1px solid;
    border-top: 1px solid;
  }

  body[data-view="run"] .hb-detail::after,
  body[data-view="run"] .hb-settings-panel::after {
    right: 8px;
    bottom: 8px;
    border-right: 1px solid;
    border-bottom: 1px solid;
  }

  body[data-view="run"] .hb-detail__title {
    margin: 0;
    color: var(--hb-heading-gold);
    font-size: 28px;
    font-weight: 500;
    letter-spacing: 1.5px;
    text-align: center;
    text-transform: uppercase;
  }

  body[data-view="run"] .hb-detail__value {
    margin: 4px 0 12px;
    color: var(--hb-text-ivory);
    font-size: 44px;
    line-height: 1;
    text-align: center;
    text-transform: uppercase;
  }

  body[data-view="run"] .hb-detail__rule {
    height: 1px;
    margin-bottom: 17px;
    background: rgba(216, 152, 32, .68);
  }

  body[data-view="run"] .hb-section-title {
    margin: 20px 0 8px;
    padding-bottom: 8px;
    border-bottom: 1px solid rgba(216, 152, 32, .48);
    color: var(--hb-frame-gold);
    font-size: 15px;
    font-weight: 500;
    letter-spacing: 4px;
    text-transform: uppercase;
  }

  body[data-view="run"] .hb-sheet__back {
    position: absolute;
    left: 28px;
    right: 28px;
    top: 574px;
    width: auto;
    height: 49px;
    min-width: 0;
    padding: 0;
    border: 2px solid var(--hb-frame-gold);
    border-radius: 0;
    background: var(--hb-forest-green);
    color: var(--hb-text-ivory);
    font-size: 24px;
    font-weight: 500;
    justify-self: stretch;
    letter-spacing: 1px;
    line-height: 1;
    text-transform: uppercase;
  }

  body[data-view="run"] .utility-modal__footer > :not(.hb-sheet__back) { display: none; }

  body[data-view="run"] .hb-stats-heading,
  body[data-view="run"] .hb-stats-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
  }

  body[data-view="run"] .hb-stats-row {
    height: calc((100% - 36px) / 9);
    font-size: 17px;
    line-height: 1;
    letter-spacing: .35px;
  }

  body[data-view="run"] .hb-stats-row::before { top: 3px; height: 38px; }
  body[data-view="run"] .hb-stats-row__value { padding-left: 14px; text-align: right; white-space: nowrap; }
  body[data-view="run"] .hb-stats-detail-copy {
    min-height: 58px;
    margin: 0;
    color: var(--hb-text-ivory);
    font-size: 18px;
    line-height: 1.45;
  }

  body[data-view="run"] .hb-source-row,
  body[data-view="run"] .hb-build-state-row,
  body[data-view="run"] .hb-inventory-affix-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 16px;
    padding: 7px 0;
    color: var(--hb-text-ivory);
    font-size: 17px;
    font-weight: 500;
  }

  body[data-view="run"] .hb-inventory-heading,
  body[data-view="run"] .hb-inventory-row,
  body[data-view="run"] .hb-build-heading,
  body[data-view="run"] .hb-build-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 108px;
    gap: 10px;
    align-items: center;
  }

  body[data-view="run"] .hb-inventory-heading,
  body[data-view="run"] .hb-build-heading { letter-spacing: 3px; }
  body[data-view="run"] .hb-inventory-heading span:last-child,
  body[data-view="run"] .hb-build-heading span:last-child { text-align: right; }

  body[data-view="run"] .hb-inventory-row {
    height: calc((100% - 36px) / 5);
    font-size: 15px;
    line-height: 1;
    text-transform: uppercase;
  }

  body[data-view="run"] .hb-inventory-row::before { top: 5px; height: 69px; }
  body[data-view="run"] .hb-inventory-row__name,
  body[data-view="run"] .hb-build-row__name { min-width: 0; white-space: nowrap; }
  body[data-view="run"] .hb-inventory-row__name::before,
  body[data-view="run"] .hb-build-row__name::before {
    content: '◆';
    margin-right: 6px;
    color: var(--hb-heading-gold);
    font-size: 8px;
    vertical-align: 1px;
  }

  body[data-view="run"] .hb-inventory-row__rarity,
  body[data-view="run"] .hb-build-row__type { text-align: right; white-space: nowrap; }
  body[data-view="run"] [data-rarity="uncommon"] .hb-inventory-row__rarity { color: var(--hb-rarity-uncommon); }
  body[data-view="run"] [data-rarity="rare"] .hb-inventory-row__rarity { color: var(--hb-rarity-rare); }
  body[data-view="run"] [data-rarity="epic"] .hb-inventory-row__rarity { color: var(--hb-rarity-epic); }
  body[data-view="run"] [data-rarity="legendary"] .hb-inventory-row__rarity { color: var(--hb-rarity-legendary); }

  body[data-view="run"] .hb-inventory-detail { padding: 24px 27px; }
  body[data-view="run"] .hb-inventory-detail .hb-detail__title { font-size: 27px; line-height: 1.05; }
  body[data-view="run"] .hb-inventory-detail .hb-detail__value { margin: 7px 0 10px; font-size: 32px; }
  body[data-view="run"] .hb-inventory-detail__state {
    margin: 0;
    color: var(--hb-text-ivory);
    font-size: 16px;
    line-height: 1.3;
    text-align: center;
    text-transform: uppercase;
  }

  body[data-view="run"] .hb-inventory-effect__title {
    margin: 12px 0 4px;
    color: var(--hb-heading-gold);
    font-size: 17px;
    font-weight: 500;
    letter-spacing: 1.5px;
    text-align: center;
    text-transform: uppercase;
  }

  body[data-view="run"] .hb-inventory-effect__copy {
    margin: 0 auto;
    max-width: 410px;
    color: var(--hb-text-ivory);
    font-size: 15px;
    line-height: 1.25;
    text-align: center;
  }

  body[data-view="run"] .hb-build-list { overflow-y: auto; overscroll-behavior: contain; }
  body[data-view="run"] .hb-build-heading { position: sticky; top: 0; z-index: 2; margin-top: 0; background: var(--hb-forest-black); }
  body[data-view="run"] .hb-build-row {
    height: 49.5px;
    font-size: 15px;
    line-height: 1;
    text-transform: uppercase;
  }
  body[data-view="run"] .hb-build-row::before { top: 4px; height: 41px; }
  body[data-view="run"] .hb-build-row__type { color: var(--hb-frame-gold); font-size: 13px; }
  body[data-view="run"] .hb-build-detail-copy {
    min-height: 74px;
    margin: 0;
    color: var(--hb-text-ivory);
    font-size: 18px;
    line-height: 1.42;
    text-align: center;
  }

  body[data-view="run"] .hb-settings-main {
    position: absolute;
    left: 28px;
    right: 28px;
    top: 120px;
    height: 432px;
  }

  body[data-view="run"] .hb-settings-panel { position: relative; width: 100%; height: 100%; overflow-y: auto; overscroll-behavior: contain; }
  body[data-view="run"] .hb-settings-content { width: 560px; margin: 0 auto; padding: 62px 0 54px; }
  body[data-view="run"] .hb-settings-section-title {
    margin: 0 0 54px;
    padding-bottom: 14px;
    border-bottom: 1px solid rgba(216, 152, 32, .68);
    color: var(--hb-heading-gold);
    font-size: 28px;
    font-weight: 500;
    letter-spacing: 4px;
    text-align: center;
    text-transform: uppercase;
  }

  body[data-view="run"] .hb-settings-volume-heading {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    margin-bottom: 18px;
    color: var(--hb-text-ivory);
    font-size: 20px;
    font-weight: 500;
    letter-spacing: 1px;
    text-transform: uppercase;
  }
  body[data-view="run"] .hb-settings-volume-value { color: var(--hb-heading-gold); font-size: 24px; }
  body[data-view="run"] .hb-settings-volume { width: 100%; height: 34px; margin: 0 0 45px; background: transparent; accent-color: var(--hb-heading-gold); }
  body[data-view="run"] .hb-settings-volume::-webkit-slider-runnable-track { height: 12px; border: 2px solid var(--hb-frame-gold); background: var(--hb-forest-green); }
  body[data-view="run"] .hb-settings-volume::-webkit-slider-thumb { width: 24px; height: 24px; margin-top: -8px; border: 2px solid var(--hb-text-ivory); border-radius: 0; background: var(--hb-heading-gold); appearance: none; }
  body[data-view="run"] .hb-settings-mute { position: relative; width: 100%; height: 64px; border: 2px solid var(--hb-frame-gold); border-radius: 0; background: var(--hb-forest-green); color: var(--hb-text-ivory); font-size: 23px; font-weight: 500; letter-spacing: 1px; text-transform: uppercase; }
}

@media (hover: none) and (pointer: coarse), (max-width: 1024px) and (max-height: 500px) {
  body[data-view="run"] .hb-pause { display: contents; }
  body[data-view="run"] .hb-pause__header { display: contents; }
  body[data-view="run"] .hb-pause__mobile-title { display: inline; }
  body[data-view="run"] .hb-pause__desktop-title { display: none; }
  body[data-view="run"] .pause-overlay__actions.hb-pause__actions { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  body[data-view="run"] .hb-pause__button--wide { grid-column: auto; }
  body[data-view="run"] .hb-pause__settings { display: none; }
  body[data-view="run"] .hb-pause__button { min-width: 0; }
  body[data-view="run"] #pauseStats { grid-column: 1 / span 2; grid-row: 1; }
  body[data-view="run"] #pauseInventory { grid-column: 3 / span 2; grid-row: 1; }
  body[data-view="run"] #pauseRunBuild { grid-column: 5 / span 2; grid-row: 1; }
  body[data-view="run"] #resumeRun { grid-column: 2 / span 2; grid-row: 2; }
  body[data-view="run"] #leaveRunFromPause { grid-column: 4 / span 2; grid-row: 2; }
}
