/* Global history dialog: scrim + shell mirror the about/account dialogs;
   the type pills borrow the games page look (transparent pills, accent
   outline on the active one). */
.history-scrim{
  position:fixed !important;inset:0;z-index:9998;background:rgba(0,0,0,0.45);
  backdrop-filter:blur(4px);-webkit-backdrop-filter:blur(4px);
  opacity:0;transition:opacity .2s ease;
}
.history-scrim[hidden]{display:none !important}

.history-dialog{
  position:fixed !important;z-index:9999;left:50%;top:50%;
  transform:translate(-50%,-50%) scale(0.96);opacity:0;
  width:min(680px,calc(100vw - 32px));height:min(76vh,680px);
  /* No radius of our own: the .glass 2rem curvature is what the account,
     about, customize and relay popups all end up using. */
  overflow:hidden;display:flex;flex-direction:column;
  transition:opacity .2s ease,transform .2s cubic-bezier(0.22,1,0.36,1);
}
.history-dialog:not([hidden]){opacity:1;transform:translate(-50%,-50%) scale(1)}
.history-dialog[hidden]{display:none !important}

.history-dialog__head{
  display:flex;align-items:center;justify-content:space-between;
  padding:16px 20px 12px;border-bottom:1px solid var(--ui-border-sub);flex-shrink:0;
}
.history-dialog__title{font-size:15px;font-weight:700;color:var(--ui-text);display:flex;align-items:center;gap:8px}
.history-dialog__title i{color:var(--ui-accent);font-size:14px}
.history-dialog__close{
  border:none;background:transparent;color:var(--ui-text-muted);cursor:pointer;
  font-size:16px;padding:4px 8px;border-radius:6px;
  transition:background .12s,color .12s;
}
.history-dialog__close:hover{background:var(--ui-hover);color:var(--ui-text)}
.history-dialog__head-actions{display:flex;align-items:center;gap:4px}
.history-dialog__clear{
  display:inline-flex;align-items:center;gap:6px;border:none;background:transparent;
  color:var(--ui-text-muted);font-family:inherit;font-size:12px;padding:5px 9px;
  border-radius:7px;cursor:pointer;white-space:nowrap;
  transition:background .12s,color .12s;
}
.history-dialog__clear i{font-size:11px}
.history-dialog__clear:hover:not(:disabled){background:var(--ui-hover);color:var(--ui-text)}
.history-dialog__clear.is-armed{background:rgba(var(--ui-danger-rgb),.12);color:var(--ui-danger)}
.history-dialog__clear:disabled{opacity:.4;cursor:default}

.history-dialog__tools{
  display:flex;flex-direction:column;gap:10px;
  padding:12px 20px 10px;border-bottom:1px solid var(--ui-border-sub);flex-shrink:0;
}
.history-search{
  display:flex;align-items:center;gap:8px;padding:8px 12px;border-radius:10px;
  background:rgba(255,255,255,0.045);border:1px solid var(--ui-border-sub);
  transition:border-color .15s;
}
.history-search:focus-within{border-color:rgba(var(--ui-accent-rgb),.5)}
.history-search > i{font-size:12px;color:var(--ui-text-muted);flex-shrink:0}
.history-search input{
  flex:1;min-width:0;background:none;border:none;outline:none;
  color:var(--ui-text);font-family:inherit;font-size:13px;
}
.history-search input::placeholder{color:var(--ui-text-muted)}
.history-search__clear{
  border:none;background:transparent;color:var(--ui-text-muted);cursor:pointer;
  font-size:11px;padding:2px 5px;border-radius:5px;flex-shrink:0;
  transition:background .12s,color .12s;
}
.history-search__clear:hover{background:var(--ui-hover);color:var(--ui-text)}
.history-search__clear[hidden]{display:none !important}

.history-tags{display:flex;flex-wrap:wrap;gap:6px}
.history-tag{
  display:inline-flex;align-items:center;gap:6px;border-radius:20px;
  border:1px solid transparent;background:transparent;
  color:var(--ui-text-muted);font-family:inherit;font-size:12px;
  padding:4px 11px;cursor:pointer;line-height:1.45;
  transition:color .15s,border-color .15s,background .15s,box-shadow .15s;
}
.history-tag:hover{color:var(--ui-text)}
.history-tag.active{
  border-color:rgba(var(--ui-accent-rgb),.55);
  background:rgba(var(--ui-accent-rgb),.12);
  color:#fff;box-shadow:0 0 10px rgba(var(--ui-accent-rgb),.18);
}
.history-tag__count{font-size:10.5px;opacity:.65}

.history-dialog__body{flex:1;overflow-y:auto;padding:12px 14px 18px}
.history-group{margin-bottom:10px}
.history-group__label{
  font-size:10px;font-weight:600;text-transform:uppercase;letter-spacing:.5px;
  color:var(--ui-text-muted);padding:6px 10px 6px;
}
.history-row{
  display:flex;align-items:center;gap:10px;width:100%;text-align:left;
  background:none;border:none;border-radius:10px;padding:8px 10px;cursor:pointer;
  color:var(--ui-text);font-family:inherit;transition:background .12s;
}
.history-row:hover{background:var(--ui-hover)}
.history-row:focus-visible{outline:2px solid var(--ui-accent);outline-offset:1px}
.history-row__icon{
  width:26px;height:26px;border-radius:8px;flex-shrink:0;
  display:flex;align-items:center;justify-content:center;font-size:12px;
  background:rgba(var(--ui-accent-rgb),.14);color:var(--ui-accent);
}
.history-row__body{flex:1;min-width:0;display:flex;flex-direction:column;gap:1px}
.history-row__title{font-size:13px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.history-row__sub{font-size:10.5px;color:var(--ui-text-muted);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}
.history-row__time{
  font-size:11px;color:var(--ui-text-muted);flex-shrink:0;
  font-variant-numeric:tabular-nums;
}
/* Faded rather than display:none so hovering a row never shifts the time. */
.history-row__delete{
  flex-shrink:0;display:flex;align-items:center;justify-content:center;
  width:26px;height:26px;border-radius:8px;border:none;background:transparent;
  color:var(--ui-text-muted);cursor:pointer;font-size:11px;opacity:0;
  transition:opacity .12s,background .12s,color .12s;
}
.history-row:hover .history-row__delete,
.history-row:focus-within .history-row__delete{opacity:1}
.history-row__delete:hover{background:rgba(var(--ui-danger-rgb),.16);color:var(--ui-danger)}
.history-row__delete:focus-visible{opacity:1;outline:2px solid var(--ui-danger);outline-offset:1px}
@media (hover:none){.history-row__delete{opacity:1}}
.history-empty{
  display:flex;flex-direction:column;align-items:center;gap:10px;
  padding:52px 24px;text-align:center;color:var(--ui-text-muted);
}
.history-empty > i{font-size:22px;opacity:.5}
.history-empty__text{font-size:12.5px;line-height:1.6;max-width:330px}
